summaryrefslogtreecommitdiff
path: root/bash-git-prompt
blob: 9bce38648d565ba655592432961c093b3b62647e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash

PS='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}<\t> \[\033[01;32m\]\u\[\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'

set -o pipefail

if branch=$(git branch 2>/dev/null | grep '\*' | cut -d' ' -f2)
then
  PS1="$PS $branch\$ "
else
  PS1="$PS\$ "
fi