Skip to content

Instantly share code, notes, and snippets.

View srguiwiz's full-sized avatar

Leo Baschy srguiwiz

View GitHub Profile
@srguiwiz
srguiwiz / .bashrc
Last active August 8, 2024 16:13 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir [master]$ # clean working directory green
# username@Machine ~/dev/dir [master*]$ # dirty working directory red*
#
function git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
# http://unix.stackexchange.com/questions/88307/escape-sequences-with-echo-e-in-different-shells
function markup_git_branch {