Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a mercurial equivalent to gits no-fast-forward merge?

What is the mercurial equivalent to gits no-fast-forward merge (in case a fast forward would be possible)?

Edit

Assume you have a branch/bookmark at your head/tip of master/default:

 o feature
 |
 o
 |
 o master/default
 |
 ...

A simple fast forward merge would result in:

 o feature/master/default
 |
 o
 |
 o
 |
 ...

A no-fast-forward merge would look like:

 o merge commit - feature/master/default
 | \
 |  o     
 |  |
 |  o
 | /
 o
 |
 ...
like image 611
mheinzerling Avatar asked Mar 15 '13 08:03

mheinzerling


1 Answers

It depends on how you committed your feature branch.

If the feature was developed on a named branch, then you can get the equivalent of a no fast-forward merge. In fact, named branches cannot be merged any other way.

hg update default
hg branch feature-1
...work...
hg commit -m "implemented feature on named branch"
hg update default
hg merge feature-1
hg commit -m "merged feature-1 to default"

This will result in a graph like this:

o   merged feature-1 to default
|\
| o feature-1: implemented feature on named branch
|/
o
|

This only works with named branches (i.e. branches created using the hg branch command). It does not work for anonymous branches or bookmarks.

You may also be interested in this thread (dead-link) on the Mercurial mail list that discusses the issue.

like image 189
Tim Henigan Avatar answered Oct 04 '22 00:10

Tim Henigan