What's the difference between git reset --mixed, --soft, and --hard?

后端 未结 15 1469
野的像风
野的像风 2020-11-22 14:39

I\'m looking to split a commit up and not sure which reset option to use.

I was looking at the page In plain English, what does "git reset" do?, but I real

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 14:59

    Here is a basic explanation for TortoiseGit users:

    git reset --soft and --mixed leave your files untouched.

    git reset --hard actually change your files to match the commit you reset to.

    In TortoiseGit, The concept of the index is very hidden by the GUI. When you modify a file, you don't have to run git add to add the change to the staging area/index. When simply dealing with modifications to existing files that are not changing file names, git reset --soft and --mixed are the same! You will only notice a difference if you added new files or renamed files. In this case, if you run git reset --mixed, you will have to re-add your file(s) from the Not Versioned Files list.

提交回复
热议问题