Git: display current branch name in the terminal
As simple as beautiful trick for me.
Add following lines to ~/.bashrc to allow your terminal to display the current branch name in the command line :
get_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="[\u@\h \W\[\033[31m\]\$(get_git_branch)\[\033[00m\]]$ "
Written with StackEdit.
Comments
Post a Comment