Skip to content

Instantly share code, notes, and snippets.

@dpkirchner
dpkirchner / .bashrc
Last active December 14, 2016 18:01 — forked from henrik/.bashrc
Got tired of leaving stashes lying around.
# 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
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# username@Machine ~/dev/dir[master*] (stashes 2)$ # dirty working dir plus there are some stashes
function parse_git_dirty {
[ ! -z "$(git status --porcelain 2> /dev/null)" ] && echo "*"
}
# http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch