Skip to content

Instantly share code, notes, and snippets.

@danish-rehman
Created January 9, 2015 02:17
Show Gist options
  • Save danish-rehman/b4b289d853d22a6e2d6e to your computer and use it in GitHub Desktop.
Save danish-rehman/b4b289d853d22a6e2d6e to your computer and use it in GitHub Desktop.
Git config advance
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
ref=${ref#refs/heads/}
unpushed=$(git log -- origin/$ref..$ref 2> /dev/null) || return
if [ "$unpushed" ]; then
    warn=' - UNPUSHED!'
fi
echo "("$ref$warn")"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment