Commit 後悔了,想要取消

Posted in :

可以使用 git log 來看目前 commit 的記錄。要取消使用指令:

$ git reset master^

$ git reset HEAD^

在誤使用 git add 增加的檔案,如何取消?

先使用 git add 1.txt 後,使用 git status 可以看到檔名變綠色。

這時想取消 1.txt ,可以使用 git status 看到,它說使用:

git rm --cached <file>... 

就可以完成。


相關文章:

剛才的 Commit 後悔了,想要拆掉重做…
https://gitbook.tw/chapters/using-git/reset-commit.html

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *