3 ms·
brname () { a=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ -n "$a" ]; then echo " [$a]" else echo "" fi } PS1="\u@\h:\w\$(brname)$ "
by zerof1l 6y ago
brname () {
a=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ -n "$a" ]; then
echo " [$a]"
else
echo ""
fi
}
PS1="\u@\h:\w\$(brname)$ "
credit: daniel.haxx.se, https://news.ycombinator.com/item?id=25043731 https://news.ycombinator.com/item?id=25043731
- abdabab 6y agoYou’d like https://ohmyz.sh/ https://ohmyz.sh/. This feature comes with the git plugin.