Created
February 4, 2016 09:38
-
-
Save Integralist/a625dd7d7c0d07bf1ad6 to your computer and use it in GitHub Desktop.
Simple check for git repo in Bash
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
function git_environment() { | |
$(git rev-parse --is-inside-work-tree >& /dev/null) | |
if [ "$?" -eq "128" ]; then | |
git_branch="" | |
else | |
git_branch=" ($(git branch | grep '^*' | cut -d ' ' -f 2))" | |
fi | |
} | |
echo $git_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment