Skip to content

Instantly share code, notes, and snippets.

@4rc0s
Created May 7, 2009 06:18
Show Gist options
  • Save 4rc0s/107945 to your computer and use it in GitHub Desktop.
Save 4rc0s/107945 to your computer and use it in GitHub Desktop.
function gr {
## If the current working directory is inside of
## a git repository, this function will change
## it to the git root (ie, the directory that
## contains the .git/ directory), and then print
## the new directory.
git branch > /dev/null 2>&1 || return 1
cd "$(git rev-parse --show-cdup)".
pwd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment