Bash git-prompt

From wikipost
Revision as of 01:42, 9 February 2024 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

automatically change the prompt when you're in a git directory

---[~/.bashrc]---
# uncomment these 5 lines to automatically show a different PS1 prompt when you enter a git directory
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWCOLORHINTS=true
PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
source /usr/lib/git-core/git-sh-prompt
---[]---