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

git, mercurial, merge

Solution

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.

Problem

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

Original source