Skip to content

Instantly share code, notes, and snippets.

@sjl
Forked from bobthecow/cdg.bash
Created April 29, 2010 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjl/383880 to your computer and use it in GitHub Desktop.
Save sjl/383880 to your computer and use it in GitHub Desktop.
A function to cd to the root of the current Mercurial repository.
#!/usr/bin/env bash
# cd to the root of the current Mercurial repo
#
# usage:
# Add the following function to your `.bashrc` or `.bash_profile` file,
# or save it somewhere (i.e. `~/.cdg.sh`) and source it in `.bashrc`
cdh () {
hg root >/dev/null && cd "`hg root`"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment