samg (owner)

Revisions

gist: 221720 Download_button fork
public
Public Clone URL: git://gist.github.com/221720.git
Embed All Files: show embed
git_branches_in_your_bash_prompt.sh #
1
2
3
4
5
6
7
8
9
# put this in your .bashrc or .profile
function parse_git_dirty {
  [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
PS1='\w $(parse_git_branch) $ '