Skip to content

Instantly share code, notes, and snippets.

@RxDx
Created May 6, 2026 23:09
Show Gist options
  • Select an option

  • Save RxDx/9694044eb43b2f2a06a508ed2666fa43 to your computer and use it in GitHub Desktop.

Select an option

Save RxDx/9694044eb43b2f2a06a508ed2666fa43 to your computer and use it in GitHub Desktop.
Bash PS1
parse_git_branch() {
git branch 2>/dev/null | sed -n 's/^\* \(.*\)/[\1]/p'
}
# Colors
COLOR_DEF='\[\e[0m\]'
COLOR_USR='\[\e[38;5;243m\]'
COLOR_DIR='\[\e[38;5;39m\]'
COLOR_GIT='\[\e[38;5;197m\]'
# Prompt
export PS1="${COLOR_USR}\u@\h ${COLOR_DIR}\w ${COLOR_GIT}\$(parse_git_branch)${COLOR_DEF}\n\\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment