Bunu yapmanın birçok yolu var, örneğin:
durumda olması değil henüz kamuya taahhüt itti:
git reset HEAD~1 --soft
İşte bu, taahhüt değişiklikleriniz çalışma dizininizde olacak, LAST taahhüdü ise mevcut şubenizden kaldırılacak. Bakınız git reset man
Eğer yaptığımız ( 'master' adlı bir dal üzerinde) halka itmek:
git checkout -b MyCommit //save your commit in a separate branch just in case (so you don't have to dig it from reflog in case you screw up :) )
normal şekilde geri dön ve it
git checkout master
git revert a8172f36 #hash of the commit you want to destroy
# this introduces a new commit (say, it's hash is 86b48ba) which removes changes, introduced in the commit in question (but those changes are still visible in the history)
git push origin master
şimdi, çalışma kopyanızdaki yerel değişiklikler olarak "bu değişiklikleri yapmak istiyorsanız (" yerel kopyanız bu taahhüde yapılan değişiklikleri saklar ") - yalnızca --no-commitseçeneği geri alma seçeneğini geri almanız yeterlidir :
git revert --no-commit 86b48ba (hash of the revert commit).
Küçük bir örnek hazırladım: https://github.com/Isantipov/git-revert/commits/master