News for hackers. Stuff that matters.
Re:Display your current git branch as part of your bash prompt by davidmathers on Monday August 17, 2009 @12:07AM (#767336)
Try this:

  export PS1='\w:$(__git_ps1 "%s")$ '
EDIT - here's mine btw:

  function parse_git_dirty {
    git diff --quiet HEAD &>/dev/null
    [[ $? == 1 ]] && echo "✎ " || echo "➜ "
  }
  function parse_git_branch {
    local branch=$(__git_ps1 "%s")
    [[ $branch ]] && echo "$branch$(parse_git_dirty)"
  }
  PS1='\u@\h $(parse_git_branch)\W $ '
If the branch has local changes it shows the pencil, in addition to the branch name. I'm still experimenting.

There are no comments on this comment yet.