devoured elysium
devoured elysium

Reputation: 105217

Using different "paths" in Mercurial - also called branching

Is it possible to have different development "paths" from a given point in Mercurial, without having to clone my project? I currently have 2-3 different implementations options for a project and I'd like to try them out. If I could just use one and at any point come back and start in another "path" without losing data from the older one that would be nice, but I am not even sure it is possible.

Thanks

Upvotes: 1

Views: 113

Answers (2)

Amber
Amber

Reputation: 527338

This is exactly what branching is designed for:

https://www.mercurial-scm.org/wiki/Branch

The easiest way to create a branch in Mercurial is to simply checkout an older version, and then commit again with something different from what you committed after it the first time. You won't lose the old following commit, the new commit will simply branch out into a new line of development and the original commit(s) will remain on the previous line of development.

Upvotes: 3

durin42
durin42

Reputation: 1467

Yes, you probably want bookmarks for this - they're a lightweight way of marking various heads without recording the names forever in the revision (which branches do.) See BookmarksExtension for more details.

http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ may also be helpful - it's essentially the canonical document on branch management strategies in Mercurial.

Upvotes: 2

Related Questions