Search code examples
mercurialmerge

Mercurial - When to use update


When do I use update vs merge? If I do a pull from a remote repository, I'm reading that I have to do update to get those changes into my working directory. But others times I'm reading that I have to do merge.

Do I maybe want to always do an update after a pull, and then do a merge only if there are conflicts?

What am I not understanding here?


Solution

  • If you have local commits: merge. If you have uncommitted local modifications: update (which will merge).

    Usually when you make a commit locally, it forks the tree when you pull. In this case you always have to merge (or rebase with the rebase extension). If you have uncommitted local modifications, then when you pull, you can update and merge the changes into your workspace.