Use better git prompt
This commit is contained in:
parent
441b6df7f3
commit
2cfbb23f00
1 changed files with 11 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
source /etc/bash_completion.d/git-prompt
|
||||||
|
|
||||||
## Path
|
## Path
|
||||||
# Default path
|
# Default path
|
||||||
export PATH="/sbin"
|
export PATH="/sbin"
|
||||||
|
@ -91,10 +93,16 @@ COLOR="$fg[$COLOR_NAME]"
|
||||||
#
|
#
|
||||||
# If we are not on a branch, print the short ref.
|
# If we are not on a branch, print the short ref.
|
||||||
function git-prompt-info {
|
function git-prompt-info {
|
||||||
REF=$(command git current-branch 2> /dev/null) || \
|
local ref=$(__git_ps1 | sed 's/(//g' | sed 's/)//g' | sed 's/^ //')
|
||||||
REF=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
|
|
||||||
|
if [ -z "$ref" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
COLOR="$fg[$FEATURE_COLORS[$(nice-hostname)]]"
|
COLOR="$fg[$FEATURE_COLORS[$(nice-hostname)]]"
|
||||||
echo "($COLOR$REF$reset_color)"
|
echo "($COLOR$ref$reset_color)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keep track of editing mode.
|
# Keep track of editing mode.
|
||||||
|
|
Loading…
Add table
Reference in a new issue