2

i want to revert TILL specific commit in git

i have done 3 commits in git

  • 1st commit > 1:am
  • 2nd commit > 2:am
  • 3rd commit > 3:am

now i want to revert directly to this specific 1st commit !

Mr punch
  • 1,756
  • 4
  • 16
  • 23

1 Answers1

1

You can do this to completely remove the unwanted commits from the history:

$ git reset --hard HEAD^^^

However if you want to preserve the history, you should use git-revert:

$ git revert <sha1-of-3rd-commit> <sha1-of-2nd-commit>

This will apply new commits that revert the old ones.

Agis
  • 32,639
  • 3
  • 73
  • 81