Skip to content

Instantly share code, notes, and snippets.

@jmjf
Last active June 14, 2025 20:18
Show Gist options
  • Select an option

  • Save jmjf/1f0ccede11a900bb1d5d3816b55b1bae to your computer and use it in GitHub Desktop.

Select an option

Save jmjf/1f0ccede11a900bb1d5d3816b55b1bae to your computer and use it in GitHub Desktop.
export GIT_PS1_SHOWCOLORHINTS=yes
export GIT_PS1_SHOWDIRTYSTATE=yes
export GIT_PS1_SHOWSTASHSTATE=yes
export GIT_PS1_SHOWUPSTREAM=yes
export GIT_PS1_SHOWCONFLICTSTATE=yes
. ~/.git-prompt.sh
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "(%s)") \$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)") \$ '
fi
@jmjf
Copy link
Author

jmjf commented Jun 14, 2025

Put this in ~/.git-prompt.sh. The comment at the top lists environment values you can set to configure flags.

This prompt combines the example in the comment with the default Debian command prompt. If you prefer a different command prompt structure, the important part of PS1 is $(__git_ps1 "(%s)").

Still not 100% happy with this. I want the branch name change color to indicate dirty state instead of needing to rely on the flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment