I just made a commit that I want to reverse, but I want to keep the bad commit in history. So, I hg update
to the previous (good) commit. Then I keep working.
This leaves me with a new head: the abandoned bad commit.
Is this bad practice? What’s the best way to keep bad commits in history while not using them?
1
If you don’t want the branch you don’t have to have it, use hg revert.
using revert will still keep the bad commit in history, it will create a new commit that undoes the changes from the bad commit.
4
If you want to keep track of the mistake in the history you want to use backout. The backout command will create a new commit that cancel the previous one. You can even document why original commit is a mistake.
1