Created
December 9, 2010 04:13
-
-
Save jamessanders/734330 to your computer and use it in GitHub Desktop.
change directory to the base of your project by looking for '.git'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change directory to the base of your project | |
# Your project base is the directory that contains | |
# either _darcs or .git | |
# to use as a command add to .zshrc or .bashrc | |
# alias base='source <path/to/base.sh> | |
CUR=$(pwd); | |
while [ ! "$CUR" = "/" ] | |
do | |
CUR=$(dirname "$CUR"); | |
([ -d "$CUR/.git" ] || [ -d "$CUR/_darcs" ]) && echo "Changing directory to $CUR" && cd "$CUR" && break | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment