刪除還沒有推送的git提交 - Remove a git commit which has not been pushed

問題:

I did a git commit but I have not pushed it to the repository yet. 我作了一個git commit但我尚未將它推送到存儲庫。 So when I do git status , I get '# Your branch is ahead of 'master' by 1 commit. 因此,當我作git status ,我獲得'#你的分支超過'master'提交1次。 git

So if I want to roll back my top commit, can I just do: 因此,若是我想回滾個人頂級提交,我能夠這樣作: spa

git reset --hard eb27bf26dd18c5a34e0e82b929e0d74cfcaab316

given that when I do git log I get: 鑑於當我作git log我獲得: .net

commit eb27bf26dd18c5a34e0e82b929e0d74cfcaab316
Date:   Tue Sep 29 11:21:41 2009 -0700


commit db0c078d5286b837532ff5e276dcf91885df2296
Date:   Tue Sep 22 10:31:37 2009 -0700

解決方案:

參考一: https://stackoom.com/question/6l9L/刪除還沒有推送的git提交
參考二: https://oldbug.net/q/6l9L/Remove-a-git-commit-which-has-not-been-pushed
相關文章
相關標籤/搜索