Reverting specific commits from git

You can use git revert with the --no-commit option. In your example:

$ git revert --no-commit b49eb8e 1d8b062
# Files that were modified in those 2 commits will be changed in your working directory
# If any of those 2 commits had changed the file 'a' then you could discard the revert for it:
$ git checkout a
$ git commit -a -m "Revert commits b49eb8e and 1d8b062"

--no-commit option will not do auto commit, it allows you to edit and add your own commit message

Note that with unlike git reset with git revert all the reverted commits will still be there in the commit history

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)