Home > Software design >  how can i revert git pull, how to bring repos to old state
how can i revert git pull, how to bring repos to old state

Time:11-03

1347

Is there any way to revert or undo git pull so that my source/repos will come to old state that was before doing git pull ? I want to do this because it merged some files which I didn't want to do so, but only merge other remaining files. So, I want to get those files back, is that possible?

CodePudding user response:

You can do git reset --hard HEAD~1 to revert to the commit before the merge commit (assuming that's the latest). If you've made additional commits after the merge one, you would do git reset --hard HEAD~n where n is the number of commits after the merge 1.

  • Related