MERCURIAL

# Mercurial Speed Guide

Article by:

## Contents

Note: Many of these commands use shortened versions of the full-length commands (e.g. addrem instead of addremove, stat instead of status), afterall, this is a speed guide!

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72  # Find the status of a repo (any uncomitted changes, revision id, e.t.c) hg stat # To pull a repo hg pull http://url.to.repo # To add/remove any files hg addrem # To detect renamed files hg addrem --similarity 100 # To remove any non-tracked files, but excluding ignored files (require purge extension to be enabled) hg purge # To remove any non-tracked files, including ignore files (requires purge extension to be enabled) hg purge --all # Commit with message hg commit -m "This is a commmit message." # Close a branch (make sure to update to branch first) hg commit --close-branch -m "Closing this branch." # Clear the working directory (update to the "null" commit) # This is good for central servers where you won't need a working copy on) hg update null # Compare local repo with default remote repo hg outgoing -v ########################## ##### BRANCH RELATED ##### ########################## # Create a named branch from the current working directory # (and then commit) hg branch newBranchName hg c -m "Started a new branch." # Switch working directory to a named branch hg update myBranchName # Find out what branch working directory is currently on hg branch ########################## ### LOOKING AT CHANGES ### ########################## # To print out differences in files between the working copy and the last commit hg diff # To print out differences only for a specific folder hg diff folderName # To print out only the filenames of files that have changes hg diff --stat # To print out the last change to a particular file (change the 1 to print out more changes) hg log -l 1 path/to/file # To print out log information for a particular branch only hg log -b "myBranchName" # You can also use a period to symbolise the current branch hg log -b . # Copy a repo, but only take a certain amount of history # This creates a repo which is not linked in any way to the first # (hash numbers change). Good for making repo smaller. hg convert --config convert.hg.startrev=123 

## Authors

### Geoffrey Hunter

Dude making stuff.