summaryrefslogtreecommitdiff
path: root/miguel-git-prompt.sh
blob: 031e88309408beb6b1aa128048484db771a43b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
miguel_git_prompt ()
{
	RED="\[$(tput setaf 1)\]"
	GREEN="\[$(tput setaf 2)\]"
	RESET="\[$(tput sgr0)\]"

	PS1=" \w"
	if git rev-parse --git-dir > /dev/null 2>&1; then
		PS1+=" [$RED"
		PS1+=`git status --porcelain | awk '{print $1}' | sort | uniq | tr '\n' ' '`
		PS1+="$GREEN"
		#PS1+=`git branch --show-current`
		PS1+=`git status --porcelain -b | head -n1`
		PS1+="$RESET]"
	fi
	PS1+=" $ "
}