Skip to content

Instantly share code, notes, and snippets.

View Plou's full-sized avatar

Plou Plou

View GitHub Profile
@Gregcop1
Gregcop1 / GitPrompt
Last active August 29, 2015 14:15
Git prompt
# Prompt
git_or_not() { git rev-parse --is-inside-work-tree &> /dev/null ; }
git_branch() {
local status="$(git status --porcelain 2> /dev/null)"
local color=''
if [[ "${status}" != "" ]]; then
color='\033[0;31m'
fi
echo -e "${color}$(git branch 2> /dev/null |grep -e ^* |sed 's/\* //')"
}