Advertisement
Guest User

parse git branch in bashrc

a guest
Feb 18th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. #region parsing des branches git
  2. parse_git_branch() { git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'; }
  3. # export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \n$ "
  4. if [ "$color_prompt" = yes ]; then
  5.     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[36m\]$(parse_git_branch)\[\033[00m\]\$ '
  6. else
  7.     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  8. fi
  9. #endregion
  10.  
  11. #region old color prompt
  12. # if [ "$color_prompt" = yes ]; then
  13. #     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  14. # else
  15. #     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
  16. # fi
  17. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement