Guest User

Untitled

a guest
Feb 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. # Determine if the current directory is a GIT repo
  2. # and print out '*' if there are changes to be committed
  3. iz_git_dirty() {
  4. #IZ_GIT=`git status 2>/dev/null`
  5. IZ_DIRTY=`git status 2>/dev/null | grep 'nothing to commit (working directory clean)'`
  6.  
  7. #if [ "." != "$IZ_GIT." ]; then
  8. if [ "." == "$IZ_DIRTY." ]; then
  9. echo '*'
  10. fi
  11. #fi
  12. }
  13.  
  14. # Determine if the current directory is a GIT repo
  15. # and print out the current branch name (and call iz_git_dirty)
  16. parse_git_branch() {
  17. BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
  18. if [ "." != "$BRANCH." ]; then
  19. echo "(${BRANCH}$(iz_git_dirty))"
  20. fi
  21. }
  22.  
  23. # Put the above stuff into the prompt
  24. if [ "$color_prompt" = yes ]; then
  25. PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(parse_git_branch)\$ '
  26. else
  27. PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
  28. fi
Add Comment
Please, Sign In to add comment