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?
Update sets the working directory's parent revision to the specified changeset (see hg help parents). If the changeset is not a descendant or ancestor of the working directory's parent and there are uncommitted changes, the update is aborted.
pull brings in remote changes to your local repo. update changes your working copy to match the newest version in your local repo. So if you clone a remote branch and keep running update, your code won't change because you're never downloading remote code.
Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed. When all heads of a branch are closed, the branch will be considered closed.
If you are using the terminal in windows add hg status --rev x:y > your-file. txt to save the list to a file. To only see changes in the current directory: hg status --rev x:y .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With