Skip to content

Instantly share code, notes, and snippets.

@geebru
Created May 7, 2026 20:59
Show Gist options
  • Select an option

  • Save geebru/76c8a0c1c61cd558bfd9ef076d646bfc to your computer and use it in GitHub Desktop.

Select an option

Save geebru/76c8a0c1c61cd558bfd9ef076d646bfc to your computer and use it in GitHub Desktop.
Current bash prompt
# --- Starship-style Prompt for Git Bash ---
# --- Dependent on Maple Mono NF ---
# Color Definitions
CLR_USER='\[\e[38;5;216m\]' # Tan/Orange
CLR_TEXT='\[\e[0m\]' # White/Reset
CLR_PATH='\[\e[38;5;150m\]' # Soft Green
CLR_GIT='\[\e[38;5;111m\]' # Soft Blue
CLR_SYMBOL='\[\e[38;5;176m\]' # Soft Purple/Magenta
CLR_RESET='\[\e[0m\]'
# Icons
GIT_ICON='󰊢' # Nerd Font Git Branch icon
# Function to build Git segment
function get_git_info() {
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
local branch=$(git branch --show-current)
# Check for dirty status to add an asterisk
local status=$(git status --porcelain 2>/dev/null)
local dirty=""
[[ -n $status ]] && dirty="*"
echo -e " on ${CLR_GIT}${GIT_ICON} ${branch}${dirty}${CLR_RESET}"
fi
}
# Main Prompt Function
set_prompt() {
# Grabbing the last command status for potential future use (like color change on error)
local EXIT_CODE=$?
# Format: user in path on branch
# Line 1: user in path on branch
# Line 2: > command
PS1="\n${CLR_USER}\u ${CLR_TEXT}in ${CLR_PATH}\w$(get_git_info)${CLR_RESET}\n${CLR_SYMBOL}> ${CLR_RESET}"
}
PROMPT_COMMAND=set_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment