I use hg command to update a project from repository (mercurial repository).
hg pull
hg update
Problem is that from my last update, I modified some files for myself. Now the concern is updating from repository will overwrite my changes. How can I prevent that?
hg pulljust retrieves new history, so would not affect uncommitted changes.hg updatewill update to the tip, but uncommitted changes are merged with the new parent.You won’t lose anything, although your merge tool may run if there are conflicts in the merge.
Note, however, that
hg update -C, will "cleanly" update to the tip, throwing out uncommitted modifications.Example
Create a simple two-changeset database. The first changeset (0) has two lines. The second changeset (1) has four lines.
Update back to the first (earlier) changeset with two lines.
Make a change to the file by adding another line.
hg stshows that a change has been made, but it hasn’t been committed withhg ciyet.Now update to the newer changeset. For this case, the merge tool will open because "Line5" conflicts with "Line3" in this new changeset. I resolved the merge and saved.
Nothing lost!
Also check out Mercurial: The Definitive Guide and other Beginner’s Guides.