简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM