Skip to content

Instantly share code, notes, and snippets.

View arrobeusa's full-sized avatar

Rob Rotarius arrobeusa

View GitHub Profile
@arrobeusa
arrobeusa / gist:71c8515faf64e09eb448a3b73ea6ceb8
Created January 17, 2024 00:39
Bash Parse Git Function
# Function to parse the current git branch
parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
# Color settings
COLOR_DEF='\e[0m'
COLOR_USR='\e[38;5;243m'
COLOR_DIR='\e[38;5;197m'
COLOR_GIT='\e[38;5;39m'
@arrobeusa
arrobeusa / gist:1319692
Created October 27, 2011 14:30
Add this to .bash_profile to see current git branch
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\h:\w \u\$(parse_git_branch)$ "