Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Mercurial merge a named-branch that isn't a head?

Basically, I have dev branch, and what I like to do is to create a feature branch while I implement something, and then merge it back. So situations like the following occurs

 a
 b
 c
 d - dev
/ 
e
f - feature

Since dev isn't a head, is it still possible to bring dev up to feature such that both dev and feature are pointing to f?

I'm pretty sure git can do this just fine, but can't seem to convince Mercurial to do the same...

like image 903
Calyth Avatar asked Oct 26 '09 16:10

Calyth


1 Answers

Carl Meyer is right. You're thinking as a git user, and Mercurial handles things differently.

You could do what Carl suggested and just force the next commit to be on the dev branch. I'd personally find this rather confusing if I saw it though, since there would be a discontinuity in the dev branch.

The way I'd handle it is to merge the feature branch back in: hg update dev && hg merge feature && hg commit -m 'Merge in the completed feature.'

This would result in a graph like:

  a - dev
  b - dev
  c - dev
  d - dev
 /|  
e | - feature
f | - feature
 \|
  g - dev

For me, this clearly illustrates exactly what happened. You branched off for a new feature and merged it into the dev branch when finished. The fact that there were no other commits on dev in the meantime is just a coincidence and doesn't have to change the workflow.

like image 109
Steve Losh Avatar answered Oct 22 '22 04:10

Steve Losh