I use a set of two-letter commands to make it easier to function in a wide range of source-code repositories without having to always remember what SCM prefix to type. It also makes some things about the different SCMs more homogeneous.
I started out by writing a perl script that can be symlinked to a bunch of two-letter commands, which works well, but you lose any SCM-specific command-line completion for your shell, so I switched to a new method: redefining aliases on every chdir. However, the old script may still be useful and you can find it here:
As for the aliases, zsh makes it easy to run a script every time the shell changes into a new directory. As such, the following script is specific to zsh (bash users can use the repos script above). You may also need a couple helper scripts on your path, depending on which SCM features you make use of.
A description of the 2-letter commands (aliases) follows:
The commands that "auto-page" pipe their output through "less -F" so that you get a pager if the output is long, and normal output if it is not. It helps to have a modern version of less to avoid jumping down to the bottom of the screen when that is not needed. Note that git auto-pages by default, so the aliases leave it alone (which ensures auto-color is unaffected).
Examples:
ci -m 'The commit message' di foobar.c lo -p (-p doesn't work for cvs or svn)
A practical example for the zsh project:
I used to maintain a git mirror of the official zsh CVS repository in the official git repo (both on SourceForge). This allows someone to pull zsh as a git repo, and keep up-to-date without ever having to fiddle with CVS. For those that want to be able to commit changes to their local git and then push them into the official CVS repo, the git-cvs-push script will figure out what changes to push and commit them into CVS via an appropriate "git cvsexportcommit" command.
Here's how this used to be set up:
git clone git://zsh.git.sf.net/gitroot/zsh/zsh cd zsh/.git cvs -z3 -d:ext:[email protected]:/cvsroot/zsh co -P zsh mv zsh cvs cd ..
After doing that, using the "pu" alias to push your git commits will run the git-cvs-push script (which makes sure that the affected files are up-to-date in the CVS checkout, modifies them, and checks them into CVS). After a few minutes, the git mirror should have updated, and your changes will be pullable by others via git. At that point you should use the "up" alias to let "git pull --rebase" reconcile the official commits with your local commits.