Skip to content

Instantly share code, notes, and snippets.

@expatjedi
Last active April 21, 2025 22:03
Show Gist options
  • Save expatjedi/0530d23a6769fecaaa11010c7c568fd5 to your computer and use it in GitHub Desktop.
Save expatjedi/0530d23a6769fecaaa11010c7c568fd5 to your computer and use it in GitHub Desktop.
Bash prompt for developers
function parse_git_dirty {
[[ $(git status --porcelain 2> /dev/null) ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_dirty))/"
}
PS1="\n\t \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "

Comments are disabled for this gist.