Reputation: 47124
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?
Upvotes: 16
Views: 7566
Reputation: 1324178
hg update
is about making your working directory the same than a given revisionSo after a pull, an hg update will change your working directory to reflect what you have pulled into your repository.
But hg merge will not reset your working directory, only merge the changes between your working directory and what you have pulled.
hg pull -u
will pull and update, refusing to merge or overwrite local changes.
added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge)
Upvotes: 16
Reputation: 66059
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.
Upvotes: 18