From a09b15fb4cdf46657f46fa23e177b079053b8fb1 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 22 Aug 2021 11:06:26 +0200 Subject: Add Git Branch to Prompt in .bashrc --- .bashrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 11528f7..a456bd1 100644 --- a/.bashrc +++ b/.bashrc @@ -25,5 +25,9 @@ alias horizons='telnet horizons.jpl.nasa.gov 6775' # a NASA server providing da GOPATH=$HOME/go PATH=$PATH:~/bin -PS1='[\u@\h \W]\$ ' +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + +PS1='[\u@\h$(parse_git_branch) \W]\$ ' -- cgit v1.2.3-70-g09d2