Bash git-prompt: Difference between revisions

From wikipost
Jump to navigation Jump to search
(Created page with " ---automatically change the prompt when you're in a git directory--- <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 GIT_PS1_SHOWCOLORHINTS=true PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "' source /usr/lib/git-core/git-sh-prompt ---[]--- </pre>")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:


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


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