Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. Add these lines to your startup bash file (e.g. ~/.bash_profile or ~/.bashrc):
  2.  
  3. ```bash
  4. function parse_git_dirty {
  5. [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
  6. }
  7. function parse_git_branch {
  8. git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
  9. }
  10.  
  11. export PS1='\u \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
  12. ```
  13.  
  14. The shell prompt will then show the current branch you are on and the status of the branch.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement