Bash git-prompt: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
 
(No difference)

Latest revision as of 01:42, 9 February 2024

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
---[]---