I have a changeset that is uncommitted. I noticed that I am currently on the wrong branch, so before I commit this, I would like to switch to the branch that I meant to be on, then commit.
How difficult is this to achieve in Hg?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If there is a linear path between the current parent revision and the target revision, then you can just issue
and Mercurial will merge the changes in your working copy into the target revision.
This is done using the full merge tool machinery so things like renames are taken into account and you’ll get a three-way merge program in case of conflicts. The shelve- and diff-based approaches lack this and requires you to fix conflicts by hand using
.rejfiles. You can even see the current merge status withhg resolve --listand re-merge selected files since Mercurial makes the necessary backups for you.If there is not a linear path, you will get this warning:
You can then get what you want by first updating back to a common ancestor, and then updating forward again. I’m not 100% sure why we issue this warning, but searching the mailinglist archives should give you the answer if you’re curious.