Git plug-in egit User Manual on Eclipse 12_reset Function

Source: Internet
Author: User

Git has three Reset Functions: soft, mixed, and hard. The differences are as follows:

LSoft-The current branch is reset to the specified commit record location, and the index and work tree remain unchanged;

LMixed-The current branch is reset to the specified commit record location, the index is updated, and the work tree remains unchanged;

LHard-The current branch is reset to the specified commit record location, and the index and work tree are updated.

It seems hard to understand. First, you must understand the three regions of git (Work tree, index area, and repository). For details, refer to git introduction.

Perform a soft test and create a soft. Java file. The file is not added to the index control.

Submit the job once, and reset the job in the history window,

View the work Tree After resetting,

It can be seen that the soft file still exists, indicating that the reset has not changed the work tree, and the soft file is not the "Question mark" icon, indicating that it has been added to the index, indicating that the index has not changed. The only reset is the history.

Create a new mixed. Java file. At this time, mixed. Java is not added to the index control, and then submit.

Reset in the history window

The result of the reset operation is as follows:

As you can see, the mixed. Java file still exists, indicating that the work tree has not changed, but the file status is untracked, indicating that the index is updated. At this time, no index control is added to the file.

Finally, let's take a look at hard reset and create a hard. Java file. At this time, no index is added to the file, and then submit the file.

Reset this submission on the history interface,

Reset and view the work tree. The result is as follows:

We can see that the hard. Java file does not exist, which indicates that the index and work tree are updated.

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.