Git Rollback Alias

Related to the Alias for Git sanity post from a few years back, recently added another to ~/.gitconfig

[alias]
  revert-merge = !git revert -m 1 $1
  rollback-merge = revert-merge

Where $1 is the commit hash. This only works for rollback of a merge commit on the main branch.

After updating ~/.gitconfig, use it like this:

git rollback-merge 23659da08bd

Found this alias helpful since I can never remember the exact command (revert or rollback? 🤔) or the -m branch argument.

Leave a Reply

Your email address will not be published. Required fields are marked *