After using the git reset operation on idea, the four options Soft, Mixed, Hard, and Keep appear.

Appear scene

Select the version that has been committed, click Reset Current Branch to Here
Insert image description here
and then the following four options will appear
Insert image description here
Here are the four options Summary of options

principle

git revert是用于“反做”某一个版本,以达到撤销该版本的修改的目的

Soft

Soft option: All changes after the selected rollback point will be retained and tracked by git. 可以在 Version Control 的 Local Changes 面板中查看到它们.

已经add到index(暂存区)的文件不会回滚,任然保留

For example: in version 3, a new file a is added, the file color is red. After add, the color of file a is green (that is, it is being tracked by git), and then reset to version 1, it is found that the color of file a is still green ( That is, it is still being tracked by git)

Summary: version 1, version 2, and version 3 of previous commits, rolled back to version 1,git的commit记录里面的文件内容(版本1、版本2)还继续遗留到本地, records of previous commits (version 2, version 3)还保留在文件里面

Guess you like

Origin blog.csdn.net/yyuggjggg/article/details/132475831