Mercurial Workflow


If you haven't used the repository in a while and want to start making changes

(this will get you up to date before you change anything)


hg pull

hg update


(get the latest changes with "pull," then apply them to your working directory with "update")



Once you've made a change and want to send it to everyone

hg pull

hg update

hg commit -m "a brief message helping others understand what you changed"

hg push


(get the latest information about changes, commit your change, push it to everyone. You've now created a new revision, and everyone will need to update to yours!)



If you try to hg push and get a message about needing to merge

hg pull

hg merge

hg commit -m "message about merging"

(now that you've merged, you can do the push)

hg push


Don't forget the commit step when merging!!



If you add a new file:

hg pull

hg update

hg addremove

hg commit -m "adding this file"

hg push



How to find out what's going on with the repository

hg status

hg log  (on a Mac or Linux, hg log | tail -r will reverse the order so latest updates are at the bottom…)

hg heads

hg outgoing

hg incoming



What's the difference between hg pull and hg update?

hg pull gets the latest information about changes from the server, but doesn't change your working copy (talks to the server)

hg update applies changes to your local working copy (doesn't need anything from server)



Things to watch out for

1. Having two files with different cases in the same directory, for example index.html and Index.html, ends up confusing things for Mac and Windows users.

2. If you can avoid it, don't rename files you've added (or make sure to use the hg rename command correctly if you do)

3. If you delete a file, use:

hg remove this_is_the_file_to_remove.html

to tell Mercurial to stop tracking it.