Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
prompt [2017/08/30 09:33] – [On Mac] rikeprompt [2017/09/01 14:28] – [On Linux] Zbigniew Jedrzejewski-Szmek
Line 7: Line 7:
 <code bash> <code bash>
 for candidate in /usr/share/git-core/contrib/completion/git-prompt.sh /usr/lib/git-core/git-sh-prompt; do for candidate in /usr/share/git-core/contrib/completion/git-prompt.sh /usr/lib/git-core/git-sh-prompt; do
 +    # This path might need to be adjusted ^^^
     ! type __git_ps1 &>/dev/null && [ -e $candidate ] && . $candidate     ! type __git_ps1 &>/dev/null && [ -e $candidate ] && . $candidate
 done done
Line 24: Line 25:
 Edit `~/.bash_profile` Edit `~/.bash_profile`
  
-    if [ -f $(brew --prefix)/etc/bash_completion.d/git-prompt.sh ]; then +<code bash> 
-         . $(brew --prefix)/etc/bash_completion.d/git-prompt.sh +if [ -f $(brew --prefix)/etc/bash_completion.d/git-prompt.sh ]; then 
-    fi +     . $(brew --prefix)/etc/bash_completion.d/git-prompt.sh        # This path might need to be adjusted 
-     +fi 
-    export GIT_PS1_SHOWDIRTYSTATE=1 + 
-    export GIT_PS1_SHOWSTASHSTATE=1 +export GIT_PS1_SHOWDIRTYSTATE=1 
-    export GIT_PS1_SHOWUNTRACKEDFILES=1 +export GIT_PS1_SHOWSTASHSTATE=1 
-    # export GIT_PS1_SHOWUPSTREAM=verbose +export GIT_PS1_SHOWUNTRACKEDFILES=1 
-    # export GIT_PS1_DESCRIBE_STYLE=branch +# export GIT_PS1_SHOWUPSTREAM=verbose 
-    export PROMPT_COMMAND='__git_ps1 "\u@\h:\w" " \\\$ "' +# export GIT_PS1_DESCRIBE_STYLE=branch 
-    export GIT_PS1_SHOWCOLORHINTS=1 +export PROMPT_COMMAND='__git_ps1 "\u@\h:\w" " \\\$ "' 
-    +export GIT_PS1_SHOWCOLORHINTS=1 
 +</code> 
 (Works only with the homebrew version of git.) (Works only with the homebrew version of git.)
 +
 +==== Missing ''git-prompt.sh'' ====
 +
 +Under both Linux and Mac, if you cannot find ''git-prompt.sh'', just get the latest version from git git
 +https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh,
 +save it anywhere in the home directory, and put the path to it in the line annotated with "This path might need to be adjusted".