Question

I was working in default, but thought to be working in another branch. I commited, but didn't push.

Now I want to change branches and commit the changes to another branch, but also dont want the commit to go to default.

How do I undo that commit?

Was it helpful?

Solution

If you are still in the draft phase (not pushed elsewhere yet), use the built-in extension hg strip <rev> command. Otherwise, you should do a hg backout, which will reverse the changeset.

In case you still need the commit you made, I suggest you export it to import it again in the correct branch, before stripping.

OTHER TIPS

If "another branch" already exist, you must move changeset to it, using hg rebase (rebase extension have to be enabled)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top