Save Keystrokes

posted by Steve Losh on October 30, 2009

If you use Mercurial’s command line interface often, it’s probably worth your time to add some aliases for the commands you use frequently.

One thing that you might not realize is that you’re not limited to just letters when creating aliases — pretty much anything that’s not a shell metacharacter is fair game.

Here are a few ideas to get you started (edit your ~/.hgrc file to use these):

[alias]
cm = commit --message
up = update --check
. = summary
? = compass
: = status

, = glog -l15 --template '\033[33;40m{rev} \033[37;40m{desc|firstline|fill68} \033[1;30;40m({date|age} ago by {author|person})\033[0;37;40m \033[33;40m{tags}\033[37;40m \033[35;40m{branches}\033[37;40m\n\n'

,+ = , -l1000000000

If you’ve got a favorite alias, post it in the comments!

Some of the things you can use for aliases might surprise you.