I created a couple of anonymous branches in Mercurial (using TortoiseHg).
But now I regret not naming them, because they're [special] revisions after all.
Is there a way to name these nameless branches?
i.e.:
Change the name of 45 and 46 from "default" to something else.
No, you can't change the branch label attached to a specific commit once you've pushed it, but you can add a new commit on that topological branch that will have the head named as you want:
hg checkout 46
hg branch what_I_wish_I_named_it
... maybe have to make a small edit here ...
hg commit
Then you'll have a new a commit whose ordinal revision number is high, but whose topological location is hanging off of 46 and it'll have the branch name you want.
Alternately, look into bookmarks, which are more like git-branches or auto-moving-tags. You could easily point a bookmark at revision 46 and it'll move forward whenever you commit on that branch.
You can do this with the hg rebase
extension.
Something like this should do it:
hg up 44
hg branch what_I_wish_I_called_45
hg commit
hg rebase --base 45 --dest 47
hg commit
hg up 44
hg branch what_I_wish_I_called_46
hg commit
hg rebase --base 46 --dest 48
hg commit
Explanation:
Also, as Ry4an pointed out in the comments, this only works if you haven't pushed the repository; if you have, the old branches will just come back. You can, however, replace the old repository with the new one. Depending on platform (github, kiln, etc.), how this works will vary, but it boils down to renaming and moving the old repository out of the way, then pushing all of the above changes into a new repository with the correct name, URL, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With