If you are a Mac user and you are using git you might have faced issue with auto completion in git commands. I was searching through the internet and perform these steps in order to enable git auto completion on my mac because it was really frustrating for me without auto-completion in git. I will tell you how you can also enable it on your Mac in some easy steps.
- Open the terminal on you Mac.
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > ~/git-auto-complete.bash
command and press Enter. This will create an auto completion script in your system's root directory with name git-auto-complete.bash.
and press enter to open bash_profile in vim.
- When vim editor will be opened press
ito go to INSERT mode.
source ~/git-auto-complete.bashin editor.
Output will look something like this.
source ~/git-auto-complete.bash ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "~/.bash_profile" 1L, 32C
ESCkey and insert mode will be exited.
Shift + :and a colon will appear and type
wqand press enter this will save the above written line in this file.
- Now close your terminal and open again.
Congrats you just got auto completion feature in git in your Mac.