Branching with Mercurial

February 6, 2022 ยท View on GitHub

I've got a detailed tutorial on branching with mercurial but here's just the cheatsheet for branching with mercurial:

CommandComment
hg branchCheck which branch you're working on
hg branch WEAPONISE_SPACECreate a branch
hg push -b . --new-branchPush only the current branch (which happens to be new
hg push -b .Push only the current branch
hg headsSee if there are any open "heads" (e.g. open branches)
hg pull -b . --rebasePull just the current branch
hg pull -b WEAPONISE_SPACE --rebasePull only the contents of a named branch (and merge any local commits you've already made)
hg up WEAPONISE_SPACESwitch to a named branch. So this will update the current working folder to contain the work from the named branch.
hg commit -Am "committing here!"Commit to the current branch, while addremoving files
hg commit -m 'Finished Weaponising Space!' --close-branchClose the current branch (good hygiene)
hg up defaultUpdate so that the current branch is now the default branch
hg merge WEAPONISE_SPACEMerge a named branch into the current branch

Source