“git rm --cached x” vs “git reset head --​ x”?

后端 未结 3 1223
青春惊慌失措
青春惊慌失措 2020-12-07 07:00

GitRef.org - Basic:

git rm will remove entries from the staging area. This is a bit different from git reset HEAD which

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 07:11

    git rm --cached file will remove the file from the stage. That is, when you commit the file will be removed. git reset HEAD -- file will simply reset file in the staging area to the state where it was on the HEAD commit, i.e. will undo any changes you did to it since last commiting. If that change happens to be newly adding the file, then they will be equivalent.

提交回复
热议问题