I just read Joel Spolsky’s outstanding introductory tutorial to Mercurial. Mercurial is a distributed Version Control System. You can read it at http://hginit.com.
Here is my glossary and workflow description from the tutorial for mercurial.
- If you haven’t done so in a while, get the latest version that everyone else is working off of:
- Make some changes
- Commit them (locally)
- Repeat steps 2-3 until you’ve got some nice code that you’re willing to inflict on everyone else
- When you’re ready to share:
- hg pull to get everyone else’s changes (if there are any)
- hg merge to merge them into yours
- test! to make sure the merge didn’t screw anything up
- hg commit (the merge)
- hg push
hg init Create a repo. Be in the directory you want to source.
hg add adds files in directory to repo
hg commit (com) Commit changes to local repo -m include a message in quotes
hg log see changes since last commit. –P shows changes that just arrived.
hg revert revert changes to last changeset –all (revert all files)
hg status list files that have change
hg diff <file> show changes in a file
hg cat print file to screen -r N <file> (where N is a changeset #) print that version.
hg update (up) -r N N is changeset #. Changes your working set to that revision. With no number goes to latest.
hg serve Share the repository in the built in web server (port 8000 default)
hg clone clone the repository hg clone <url/path-to-repo> <new folder name>
hg push Pushes changes from local repo to central repo
hg outgoing (out) Lists changes that are waiting to be sent to central repo
hg incoming (in) Lists changes that are waiting to be sent from central repo to local repo
hg merge combines changeset into new tip. Then use commit to commit merge to repo. If merge fails you can revert it. On success you can commit it.
hg parent tells you what changeset your are working in. Pull does not change your changeset so a pull is always safe.
hg rollback Undoes one commit but only if it hasn’t been pushed. (Revert changes to the last commit whereas rollback reverts the last commit.)
hg paths default = shows the path to the default repository that a push will use.
Hg backout –r N –merge undoes a particular changeset from the working directory
hg tag <name> Give current changeset a name. Then you can use it for N.
If you see when doing a push…
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)
…then you need to do a Pull then do a Push