To see what shell you are using, you can:
echo $SHELL
and it will tell you.
Use the below only if you are using bash.
Run the following to create ~/.git-completion.bash
:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > ~/.git-completion.bash
and ~/.git-prompt.sh
:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~/.git-prompt.bash
Then add the following to your ~/.bashrc
after PATH
:
# Source the git bash completion file
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
# Source the git bash prompt file -- note part changes your existing bash prompt (would be nice to re-work)
if
source ~/.git-prompt.bash
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWCOLORHINTS=true
export PROMPT_COMMAND='__git_ps1 "\w" "\\\$ "'
fi