branches, bookmarks, new heads

David Demelier demelier.david at gmail.com
Mon Jan 9 12:23:48 UTC 2017


On 12/30/2016 07:03 PM, Uwe Brauer wrote:
> Hi
>
> The following
>
> hg init
> echo feature > new.el
> hg add new.el
> hg commit -m feature1
> hg branch feature
> echo feature >> new.el
> hg commit -m feature
>
> Generates a new head, while
>
>
> hg init
> echo feature > new.el
> hg add new.el
> hg commit -m feature1
> hg bookmark feature
> echo feature >> new.el
> hg commit -m feature
>
> Does not.
>
> When using a bookmark could a head  optionally be created?

The best history is the one that does not have a head. Bookmarks are 
temporary and only pointers to commits. IIRC you already asked this 
question a while ago.

Let say you have a bookmark @ (the git master equivalent)

hg up @
hg book feature1
... code ...
hg ci
... code ...
hg ci

feature1 is now ahead of 2 commits, marking the feature as finished is 
simple, just move the @ bookmark where feature1 is and just delete the 
feature1 bookmark.

No head, no merge, pure linear based history.

However, you can still create a head if you need to fix something in the 
@ line of work

(as before)
hg up @
... code ...
hg ci <- creates new head

Then, if you decide to "mark" feature1 as done, if all code is draft you 
can rebase feature1 on top of @ or merge if already public.

Regards,

-- 
David


More information about the Mercurial mailing list