Created
September 29, 2015 14:45
-
-
Save patricknelson/56d0dd50622320e9f095 to your computer and use it in GitHub Desktop.
When you're too stupid to realize you need to "git checkout [branch]" and not "cd" into it.
This file contains 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
cd() { | |
if [ -d .git ] && [ ! -d $@ ]; then | |
git checkout "$@" | |
else | |
command cd "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment