A Guide to Branching in Mercurial
Abderrahim Kitouni
a.kitouni at gmail.com
Sat Sep 5 04:51:10 CDT 2009
2009/9/5 Alexander Schatten <ml_alexanderschatten at gmx.at>:
> May I add one question here, though, that I was already struggling with and that is in my opinion related. Assume this situation:
>
>
> (1) I have a piece of Code version controlled and I am, say, at Rev. 10. Everything is fine so far.
>
> (2) Now I continue a "risky" feature development, say until Rev. 15. Then I figure this leads nowhere, I have broken the system, whatever.
>
> (3) Hence I go back to rev. 10 (hg update 10). This was the last stable version. Then I continue working from here (Rev. 16, 17, ...). In effect I made a branche. This is why I have SCM, right?
>
> Now: the thing is: this unnamed branch Rev. 11-15 will allways annoy me in the future, because I cannot push and I definitly do not want to merge crappy code into my main line of dev.
>
> What should be done in such a situation? Name the crappy branch? But then I have 100 names for each crappy side-stream that distract me? Is it possiblelto "end" such an unnamed branch, like "set it deprecated" so that it is not named, but not interfering any longer?
The thing to do here is to make a new clone, cloning only to the good
revision, 'hg clone -r <rev> <repo>' (where rev is the latest good
revision), and keep using the new clone (and archive the old one, or
delete it if you're sure you don't need it anymore).
(this can also be acheived using the strip command from mq extension,
but it is recommended to use clone)
HTH,
Abderrahim
More information about the Mercurial
mailing list