Bash git-prompt: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 3: Line 3:


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




</pre>
</pre>

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