re: 10 insanely useful Git commands you wish existed – and their alternatives VIEW POST


It'd be worth mentioning for #5 that reverting a merge commit is something you want to avoid if possible as it creates a mess when you want to merge your branch again later.

If your merge hasn't been pushed to a shared branch yet, git reset --hard <original-branch-head> is preferable as it actually removes all trace of the merge.

From the git revert docs:

Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring in [commits introduced since the reverted merge]. This may or may not be what you want.

See the revert-a-faulty-merge How-To for more details.


I agree, and this is also what I recommended in the git tip :)

Regarding using git reset command, you are correct, but I wanted to address the more complex scenario - when it was pushed to a shared branch.

code of conduct - report abuse