projects
/
scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9a5a6e9
)
Added the git branch info to PS1.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 3 May 2021 08:56:31 +0000
(10:56 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 3 May 2021 08:56:31 +0000
(10:56 +0200)
bashrc
patch
|
blob
|
history
diff --git
a/bashrc
b/bashrc
index
f50d7cc
..
f312fc0
100644
(file)
--- a/
bashrc
+++ b/
bashrc
@@
-908,6
+908,20
@@
function mvtoconfig () {
fi
}
fi
}
+
+######################################################################
+# git prompt
+
+if which > /dev/null git
+then
+
+ parse_git_branch() {
+ git 2>/dev/null rev-parse --abbrev-ref HEAD | sed -e 's/^\(.*\)$/(\1) /'
+ }
+
+ export PS_GIT="${VT_WHITE_BG}${VT_GREEN_FG}\$(parse_git_branch)${VT_RESET}"
+fi
+
######################################################################
# The complex prompt policy
######################################################################
# The complex prompt policy
@@
-955,7
+969,7
@@
else
fi
fi
-PS1="${PSCUE}${PS1}"
+PS1="${PS
_GIT}${PS
CUE}${PS1}"
######################################################################
# This implements a local history. If we are in a directory containing
######################################################################
# This implements a local history. If we are in a directory containing