Skip to content

Instantly share code, notes, and snippets.

@kunicmarko20
Created December 14, 2016 09:09
Show Gist options
  • Save kunicmarko20/03864f41ae1823b8508ad8ad0a1834c3 to your computer and use it in GitHub Desktop.
Save kunicmarko20/03864f41ae1823b8508ad8ad0a1834c3 to your computer and use it in GitHub Desktop.
Check for active git branch when changing folder
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