If you enable the rebase extension, for a branch called mywork
, it is simply:
hg up 'max(roots(branch(mywork)))^1'
# dummy change
hg ci -m "rebasing mywork"
hg rebase -b mywork
If that didn't work, you'll be able to restore things by using hg unbundle
on the backup bundle displayed on screen after the hg rebase
command.
If you don't know, you can enable the rebase extension by adding rebase=
to an extensions section of hgrc. More specifically, add this at the end of your repository's .hg/hgrc
:
[extensions]
rebase=
While removing a branch name is an after-effect of rebase, it still works. Of course, Mercurial now warns you when you use hg branch
that it is global and what you meant was maybe a bookmark, useful if your background is Git.
Speaking of Git, I found the Github tutorial absolutely horrible. It fails at explaining the meaning or syntax of the commands it asks you to run. Worse, by the end of it, it shows you a "best practice" of creating a private branch which ends up being merged (debased in Mercurial parlance) on the main (master) branch, and then summarily deleted after doing so. Showing such a destructive operation for a version control system to brand new users kind of defeats the purpose, whatever it could have been.
It may be too late now, since Git is cool and all, but it would have helped to have some usability experts help designing (and naming things in) its command-line interface. Having been involved into training others in version control systems, the conceptual model of Git is so badly design that I suspect most Git users have no idea what they do, and have so much pain learning it that they have to justify their use of it to others religiously, like Vim, EMACS, Eclipse and so on. I guess mnemonic is just another term for blissful ignorance.
Published on July 9, 2012 at 21:30 EDT
Older post: My Top 5 Video Games Intros
Newer post: Culture Shock