Skip to content

Instantly share code, notes, and snippets.

@t2b
Created January 30, 2016 20:52
Show Gist options
  • Save t2b/0d8db8a4cd4dc0cd32d2 to your computer and use it in GitHub Desktop.
Save t2b/0d8db8a4cd4dc0cd32d2 to your computer and use it in GitHub Desktop.
cd into git root directory
git-root () {
if [[ $(git rev-parse --is-inside-work-tree 2>&1) = "true" ]]
then
cd $(git rev-parse --show-toplevel)
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment