What is the difference between git rm --cached and git reset ?

后端 未结 2 1994
借酒劲吻你
借酒劲吻你 2021-02-04 04:25

According to the git rm documentation,

--cached
Use this option to unstage and remove paths only from the index.    
Working tree files, whether modified or not         


        
2条回答
  •  别跟我提以往
    2021-02-04 05:15

    git rm --cached removes the file from the index but leaves it in the working directory. This indicates to Git that you don't want to track the file any more.

    git reset HEAD leaves the file as a tracked file in the index, but the modifications cached in the index are lost. This has the effect as if the file in cache had been over written by the file in HEAD (and the working tree file being untouched)

提交回复
热议问题