Guest User

Untitled

a guest
Feb 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. if where git &>/dev/null; then
  2. function prompt-git-branch() {
  3. local branch_name
  4.  
  5. # TODO: show proper name if some heads point the same branch.
  6. branch_name="$(git name-rev --name-only HEAD 2>/dev/null)"
  7. if [ $? = 0 ]; then
  8. echo " [$branch_name]"
  9. return 0
  10. else
  11. return 1
  12. fi
  13. }
  14. else
  15. function prompt-git-branch() {
  16. echo ''
  17. }
  18. fi
Add Comment
Please, Sign In to add comment