Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 443
Greg Avatar asked Jun 23 '10 16:06

Greg


People also ask

What does hg update do?

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.

What does pull to update mean?

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.

What does hg commit do?

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.

What hg command shows a list of changed files?

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 .


1 Answers

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.

like image 101
ataylor Avatar answered Oct 01 '22 17:10

ataylor