April 23, 2020 /   Git   MAC OS

For people who are using MAC and have not already figured it out, git commands autocomplete seem to not work on MAC OS.

Following are the steps to add git bash completion

  1. Install homebrew
  2. Install Git and bash-completion:

    brew install git bash-completion
    

    (Note: If this install fails with a 404 error, and you already have git installed, just remove the git part of this brew install)

  3. Add bash-completion to your ~/.bash_profile:

     [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . 
        "/usr/local/etc/profile.d/bash_completion.sh"
    

  4. Restart your terminal or do

    "source ~/.bash_profile"
    

Go to any directory with git repo and give it a try,