Skip to content

Instantly share code, notes, and snippets.

@celsobessa celsobessa/.bashrc

Created Nov 29, 2019
Embed
What would you like to do?
show git branch on your terminal prompt for unix like systems (unix, linux, macOs)
# Add this to ~/.bashrc
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="[\u@\h \W]\$(git_branch)\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.