Skip to content

Instantly share code, notes, and snippets.

View szymon-jez's full-sized avatar

Szymon Jeż szymon-jez

View GitHub Profile
@szymon-jez
szymon-jez / .extend.prompt.bashrc
Last active January 15, 2018 12:17 — forked from justintv/.bashrc
Display git branch in bash prompt and start prompt in new line
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
parse_git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]$(parse_git_branch)\n\$\[\033[00m\] '
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# This will also make the command line be in two lines.