Eclipse git control action fallback to history commit reset Delete (undo) History of a Commit

Source: Internet
Author: User
Tags commit mixed

Work area--"staging area--" local warehouse--"Remote Git repository

(Personal understanding, wrong point)


Reset Operation

Suppose I created a new file Newfile.text in the workspace and submitted it to the local repository

operation mode 1: (branch latest commit record)

Select Project right mouse button--team--reset--remote Tracking Select the latest version of the Remote Git repository branch

There are three options under--reset type

Soft: The modification of the workspace file is not changed, the commit record is reset (the file exists in the staging area; You can choose this method to re-fill the commit record when the commit record commits); the status of the Newfile.text file is a plus +

Mixed: The workspace file changes unchanged, the commit record is reset (the file exists in the workspace and needs to be resubmitted; When a commit record commits several files and does not want to upload, you can choose this way to re-select the uploaded file); the status of the Newfile.text file is a question mark.

Hard: Workspace file modification is deleted, using the latest branch version (the latest code inside the remote git server, overwriting the local code); Newfile.text was deleted.

--click Reset to perform mode 2: (any commit record for the current branch)

Project right--team--show in history--Select commit record right mouse button--reset

Effect same Way 1

Soft, Mixed operation will make head record change (head represents the record of the current workspace pointing to commit)

Hard if the file is only in the workspace (the flag is a question mark), it does not change, whereas the overwrite


Revert commit Operation

Select Project--team--show in history--Select version Right-click--revert commit--Submit

The undo action automatically generates a commit record

The following are personal understandings:

Reset--hard (use cautiously): Staging area, local repository modification, will be deleted commit record, file;

has been submitted to the remote Git repository, will prompt you to pull the latest code, if there are commit changes to the local repository, automatic pull code and then merge)

(for example, I reset to a version, to test the code, to see the effect of the previous version of the code)

Rever commit: The record of the operation is saved, the commit record is automatically generated, and the revocation is in effect for the action commit record (for example, I have just submitted a code with a problem, to delete the newly submitted code)


As an example:

If a commit record is incremented from 1 to 5:1,2,3,4,5

Operation 3rd Record

The effect of the reset--hard is: 3 (after the record is gone)

Revert the effect of commit is: 1,2,4,5 (3 This record is gone)



Clear local git modifications

Project Right-click--team--advanced--clean ... (Clear Branch modification)


Project Right--team--stashes--stash changes: Store This modification (not submitted only)


Project right---team--show in the history will see the full commit record

Project right--team--show in history--Modify: Can modify annotations



Eclipse,git Control import Maven project: Import--git--projects from git--existing Local repository (import an existing local library)--next Select a project--nex--three options:

Import existing Eclipse Projects (will automatically be imported into the project, this is usually selected),

Import using the New Project Wizard (you can reconfigure the project using the Project Guide)

Import as General project (similar to folder hierarchy, you can manually choose to convert to project)



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.