參考文章:
https://www.cnblogs.com/miracle77hp/articles/11163532.html
$ git status
git checkout --?
$ git checkout -- music.mp3
$ git reset HEAD?music.mp3
$ git reset --hard 3628164
1.?git checkout -- file命令中的 -- 很重要,
2. 命令git checkout -- music.mp3意思就是,把music.mp3在工作區(qū)的修改全部撤銷。
又回到了(git add . 時(shí)的狀態(tài))
一種是readme.txt自修改后還沒有被放到暫存區(qū),現(xiàn)在,撤銷修改就回到和版本庫一模一樣的狀態(tài);一種是readme.txt已經(jīng)添加到暫存區(qū)后,又作了修改,現(xiàn)在,撤銷修改就回到添加到暫存區(qū)后的狀態(tài)??傊褪亲屵@個(gè)文件回到最近一次git commit或git add時(shí)的狀態(tài)。