Skip to content

Instantly share code, notes, and snippets.

@philstrong
Forked from ivanoats/gist:1823034
Last active October 17, 2018 19:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save philstrong/83bd14a85f7bebf7fc01 to your computer and use it in GitHub Desktop.
Save philstrong/83bd14a85f7bebf7fc01 to your computer and use it in GitHub Desktop.
Setting up GIT Bash autocompletion. Use this only if you are using Bash instead of ZSH.

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 ~/.bash_profile after PATH:

# Source the git bash completion file
if [ -f ~/.git-completion.bash ]; then
    source ~/.git-completion.bash
    source ~/.git-prompt.bash
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment