Created
March 23, 2019 13:59
-
-
Save lomholdt/26080bca50dd7427370c3f067a4eb90c to your computer and use it in GitHub Desktop.
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
# get the current branch | |
function get_branch { | |
value=$(cd $current_path; git rev-parse --abbrev-ref HEAD) | |
echo $value | |
} | |
# # Determine if we are in a git repo | |
# function is_git_repo { | |
# if [ -d $current_path/.git ]; then | |
# return 1 | |
# elif [ $(cd $current_path; git rev-parse --is-inside-work-tree) ]; then | |
# return 1 | |
# else | |
# return 0 | |
# fi; | |
# } | |
# if is_git_repo; then | |
# get_branch | |
# else | |
# echo no branch | |
# fi | |
# Determine if we are in a git repo | |
if [ -d $current_path/.git ]; then | |
get_branch | |
elif [ $(cd $current_path; git rev-parse --is-inside-work-tree) ]; then | |
get_branch | |
else | |
echo no branch | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment