Bash - Get to the top of a git tree

# One-Line version function cdp() { TEMP_PWD=`pwd`; while ! [ -d .git ]; do cd ..; done; OLDPWD=$TEMP_PWD; }; cdp; # Expanded Version function cdp() { TEMP_PWD=`pwd` while ! [ -d .git ]; do cd .. done OLDPWD=$TEMP_PWD }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.