Skip to content

Instantly share code, notes, and snippets.

@marshally
Created August 20, 2012 18:21
Show Gist options
  • Save marshally/3406413 to your computer and use it in GitHub Desktop.
Save marshally/3406413 to your computer and use it in GitHub Desktop.
Git prompt improvements for bash-it
# Checks if there are commits ahead from remote
function git_prompt_ahead() {
if [[ -n $(git log origin/$(current_branch)...HEAD --right-only 2> /dev/null | grep '^commit') ]]; then
echo -e "$SCM_THEME_PROMPT_AHEAD"
fi
}
# Checks if there are commits available from remote
function git_prompt_behind() {
if [[ -n $(git log origin/$(current_branch)...HEAD --left-only 2> /dev/null | grep '^commit') ]]; then
echo -e "$SCM_THEME_PROMPT_BEHIND"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment