Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to revoke commits?

Tags:

git

Assume we have a repository and 5 commits:

  • commit 1
  • commit 2
  • commit 3
  • commit 4
  • commit 5

And now I realize commits 4 and 5 are a bad idea. I want to completely remove all changes committed in commit 4 and 5. How to do it?

like image 820
aster Avatar asked Aug 08 '10 11:08

aster


1 Answers

git revert commit_hash

It reverts given commit. Note that revert is another commit which discards changes from commit_hash, not removing given commit from repository.

like image 96
skalee Avatar answered Sep 25 '22 21:09

skalee