Skip to content

Instantly share code, notes, and snippets.

@chris-piekarski
Created October 27, 2025 04:13
Show Gist options
  • Select an option

  • Save chris-piekarski/faabbc04d44228ec2087dcfc27f8b9ad to your computer and use it in GitHub Desktop.

Select an option

Save chris-piekarski/faabbc04d44228ec2087dcfc27f8b9ad to your computer and use it in GitHub Desktop.
PS1
sudo apt install bash-git-prompt
PS1='$(
# choose symbol & color
last_exit=${LAST_EXIT:-0}
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
symbol="⎇"; color="\033[0;32m" # green in git repo
else
symbol="λ"; color="\033[0;36m" # cyan otherwise
fi
[ "$last_exit" -ne 0 ] && symbol="✘" && color="\033[0;31m" # red on failure
printf "%b%s%b" "$color" "$symbol" "\033[0m"
) \
\[\033[0;33m\]\w\[\033[0m\]$(
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
[ -n "$branch" ] && printf " [\033[0;35m%s\033[0m]" "$branch"
) \
\n\[\033[0;37m\]$(date +%H:%M:%S)\[\033[0m\] $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment