jjxtra
jjxtra

Reputation: 21140

Mercurial - commit and then pull new changes creates multiple heads

How do I tell mercurial to merge automatically when I pull even if I have committed changes that have not been pushed yet?

When I commit and then pull new changes, I get two heads.

Git seems to do this by default, so I'm hoping it's a setting somewhere. I am using SourceTree as my GUI for mercurial.

Upvotes: 1

Views: 328

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78330

Merging is coding and you should really question your decision to do it automatically. With git the common advice is to use the --ff-only option for git pull which tells git to only do the merge if it's a "fast forward" which is to say "not really a merge at all with no local changes"

In either git or Mercurial most people are to the point where they prefer --rebase instead of auto-merging. It modifies your local work to append it to the end of the work you just pulled down and saves you the creation of a new merge changeset.

If you absolutely want to auto-merge in Mercurial the command is hg fetch but you have to enable it in the [extensions] section of your ~/.hgrc because it's just a bad idea that it's disabled by default (but does ship w/ Mercurial so there's nothing to install).

Upvotes: 1

Related Questions