Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show current branch in Bash
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
PS1="$PS1\$(parse_git_branch)$ "
@O5ten

This comment has been minimized.

Show comment
Hide comment
@O5ten

O5ten Dec 16, 2014

Add the above to your ~/.bashrc with your favourite editor
source ~/.bashrc

Owner

O5ten commented Dec 16, 2014

Add the above to your ~/.bashrc with your favourite editor
source ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment