Guest User

Untitled

a guest
Dec 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function parse_git_branch {
  2. ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  3. echo " @" ${ref#refs/heads/}
  4. }
  5.  
  6. function count_git_changes {
  7. out=$(git status --porcelain 2> /dev/null) || return
  8. git status --porcelain | grep -E "^\ M|\?\?|^ D" | wc -l | awk '{ print " *" $1 " "}'
  9. }
  10.  
  11. # \h to add the hostname.
  12. PS1="\w\$(parse_git_branch)\$(count_git_changes)\$ "
Add Comment
Please, Sign In to add comment