Skip to content

Instantly share code, notes, and snippets.

@pete
Created January 31, 2009 21:24
Show Gist options
  • Save pete/55665 to your computer and use it in GitHub Desktop.
Save pete/55665 to your computer and use it in GitHub Desktop.
cdgit() {
pushd .
while [ ! -d .git ]; do
cd ..
if [ $(pwd) = '/' ]; then
echo 'Not in a git repo.' >&1
popd
return
fi
done
popd
cd -
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment