Revering commits in Git
Git revert undoes a single commit. It does not revert back to a previous state of the project by removing previous commits. In git this is called reset.
If you have published work to your origin, you probably don’t want to reset the branch since that is effectively rewriting history. In this case you will want to revert the commits. This will create new commits that will reverse the unwanted commits. This way the history is not rewritten.
#Revert vrs Reset
#Reverts the last two commits git revert HEAD~2..HEAD
#Reverting a merge commit
git revert -m 1
blog comments powered by Disqus