Git: Cancel rewriting history?

I have a problem with the following situation:

  • several commits are transferred to the remote (our codereview system)
  • the developer rewrote the story (edited some commit during rebase) locally
  • when you try to click again, codereview does not accept it (since this change has already passed, the review has passed)

How can I reset 'a -single- fix what is on this remote?

Modified commit is not always HEAD, so I can’t just do a 'git reset --hard HEAD ^ && & git pull'.

edit:

Preferably, the difference between the two versions is created as a new latch, but this is not necessary.

+4
source share
1 answer

Check reflog with

git reflog 

Then select the HEAD that matches the commit of your choice, for example

 git reset --hard HEAD@ {5} 

will reset your branch to the HEAD point, pointed five commits back.

+3
source

Source: https://habr.com/ru/post/1402426/


All Articles