Show git branch on prompt: Unterschied zwischen den Versionen

Aus Laemmi´s Wiki
Zur Navigation springen Zur Suche springen
Zeile 2: Zeile 2:
 
== Edit .profile and add follow: ==
 
== Edit .profile and add follow: ==
  
  parse_git_branch() {
+
  export PS1="\[\033[00m\]\u@\h\[\033[01;33m\] \w \[\033[31m\]\$( git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' )\[\033[00m\]$\[\033[00m\] "
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
 
}
 
export PS1="\[\033[00m\]\u@\h\[\033[01;33m\] \w \[\033[31m\]\$( parse_git_branch )\[\033[00m\]$\[\033[00m\] "
 

Version vom 15. März 2019, 10:29 Uhr

Edit .profile and add follow:

export PS1="\[\033[00m\]\u@\h\[\033[01;33m\] \w \[\033[31m\]\$( git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' )\[\033[00m\]$\[\033[00m\] "