Photos
Blog
Projects
vanrenterghem.biz
projects
/
Dotty.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
84c5cbe
)
Show git branch in command prompt.
author
Frederik Vanrenterghem
<frederik@vanrenterghem.biz>
Fri, 16 Jun 2023 02:10:45 +0000
(10:10 +0800)
committer
Frederik Vanrenterghem
<frederik@vanrenterghem.biz>
Fri, 16 Jun 2023 02:10:45 +0000
(10:10 +0800)
bash/.bashrc
patch
|
blob
|
history
diff --git
a/bash/.bashrc
b/bash/.bashrc
index 84ee2e478907d829fe2d82f340971c5c64008a3c..3b7c8b6c22ac69926318bb62db040bbf6f51fba8 100644
(file)
--- a/
bash/.bashrc
+++ b/
bash/.bashrc
@@
-6,7
+6,12
@@
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
-PS1='[\u@\h \W]\$ '
+
+git_branch() {
+ git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
+}
+
+PS1="[\u@\h \W]\[\033[00;32m\]\$(git_branch)\[\033[00m\]\$ "
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then