Created
December 14, 2016 09:09
-
-
Save kunicmarko20/03864f41ae1823b8508ad8ad0a1834c3 to your computer and use it in GitHub Desktop.
Check for active git branch when changing folder
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
alias cdg=gitdir | |
gitdir(){ | |
cd $1 | |
count=$(find . -name .git -type d -maxdepth 1 | wc -l) | |
if [ $count -gt 0 ]; then | |
git branch | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment