just want to change the parent revision that the branch came from
Just rebase: hg rebase -s MOVED_ROOT -d NEW_PARENT_OF_MOVED_ROOT --keepbranches
Question
I created a named branch in our repository for a feature - however, against my better judgement, I branched off of our head revision instead of an earlier one (where I branched off multiple feature branches).
I've made some commits to this branch - they are local only, not yet pushed - but I'd like to move the branch root to an earlier revision on my default branch. I don't want to make any changes to my commits (as there won't be any conflicts); I basically just want to change the parent revision that the branch came from, if that's possible.
How can I do this easily in Mercurial?
Solution
just want to change the parent revision that the branch came from
Just rebase: hg rebase -s MOVED_ROOT -d NEW_PARENT_OF_MOVED_ROOT --keepbranches
OTHER TIPS
Well, it's a bit more complex than calling one command, but you can do it:
Here is sample list of commands:
hg init
echo "Hello" > readme.txt
hg addremove
hg commit -m "Hello added"
echo "Hello2" >> readme.txt
hg commit -m "Hello2 added"
hg branch feature
echo "Feature added" >> readme.txt
hg commit -m "Feature added"
echo "Feature2 added" >> readme.txt
hg commit -m "Feature2 added"
hg export -o patch 2:3
hg strip 2:3
hg up 0
hg branch feature
hg import patch
P.S. For strip command you need to enable mq
extension.