branches, bookmarks, new heads

Uwe Brauer oub at mat.ucm.es
Tue Jan 10 14:43:39 UTC 2017


   > On 12/30/2016 07:03 PM, Uwe Brauer wrote:

   > The best history is the one that does not have a head.

I strongly disagree, I find the following graph
  changeset:   3:7a4a5f52960e
|  tag:         tip
|  parent:      0:02c2a80b8472
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Tue Jan 10 14:31:14 2017 +0000
|  summary:     3
|
| o  changeset:   2:00b737a82f96
| |  branch:      master
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Tue Jan 10 14:31:13 2017 +0000
| |  summary:     2
| |
| o  changeset:   1:30303562fd46
|/   branch:      master
|    user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Tue Jan 10 14:31:12 2017 +0000
|    summary:     1
|
o  changeset:   0:02c2a80b8472
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Tue Jan 10 14:31:12 2017 +0000
   summary:     0

Logically and easy to understand and I would prefer it much over a
linearized version. That is why I don't like rebase. I would prefer a
merge.

   > Bookmarks are temporary and only pointers to commits.



   > IIRC you already asked this question a while ago.

You memory seems to be better than mine and you are right, I checked and
now I apologize.

   > 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.

Which as I say find less informative than a non linear history.
   > However, you can still create a head if you need to fix something in the @ line of work

   > (as before)
   > hg up @


What I can say is this
if I chose a named branch

 hg init               
 echo one > test.txt   
 hg add test.txt       
 hg commit -m "0"      
 hg branch master      
 echo two >> test.txt  
 hg commit -m "1"      
 echo three >> test.txt
 hg commit -m "2"      
 hg update default     
 echo four >> test.txt 
 hg commit -m "3"      
 hg log -G             

Would give the graph I showed. However in order to get something similar
for bookmarks, I have to use 2 bookmarks


 hg init               
 hg bookmark master
 echo one > test.txt   
 hg add test.txt       
 hg commit -m "0"      
 hg bookmark book1     
 echo two >> test.txt  
 hg commit -m "1"      
 echo three >> test.txt
 hg commit -m "2"      
 hg update master      
 echo four >> test.txt 
 hg commit -m "3"      
 hg log -G

I find this counter intuitive but most likely I am the odd one here,
since most people prefer linearized history.


Uwe Brauer 




More information about the Mercurial mailing list