1

I'm looking for revert everything which not pushed into the remote branch. I have used git revert -m 1 <merge commit hash> as in this question on StackOverflow but it is only reverting one commit which I'm not expecting. In my project I have,
One Merge
One Merge commit
Two other commits

I want to revert all by using some method. Any help would be greatly appreciated.

INDRAJITH EKANAYAKE
  • 3,894
  • 11
  • 41
  • 63

1 Answers1

1

First of all list the last 5 commits let's say and get the hash of the last commit that you want to keep:

git log -n5

Then do a hard reset to that commit:

git reset --hard <hash-of-last-commit-to-keep>

NOTE! This method will destroy the commits you don't want to keep, it won't create revert commits.

ovimunt
  • 187
  • 1
  • 13