Tuesday, July 14, 2015

Set your prompt with git branching information

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}

function remoteBranch() {
    git rev-parse --abbrev-ref --symbolic-full-name @{u} 2> /dev/null | sed 's/origin\///'
}

PS1="\[\e[01;31m\]\$(parse_git_branch)\[\e[00m\]:\$(remoteBranch) \w:\n\[\e[01;31m\]$ \[\e[00m\]"


Very helpful to when you are juggling several beasts at the same day

No comments:

Post a Comment