How to enable auto complete for git commands and branches on Mac OSX terminal / Command line

GIT and Bash Logos

If you want to enable tab auto complete at the command line on Mac OSX terminal, there is a handy auto-completion script you can use.

Using git-completion script to enable auto complete for GIT commands

    1. Download and save the git-completion script to your home directory
    2. Then open the .bash_profile file in your home directory
    3. Add this at the end of .bash_profile
    4. Make the .git-completion.bash in your home directory executable
    5. Finally reload the .bash_profile with the following command, or just close and re open the shell and your git auto completion should be working.

The same method can be adapted to Centos6, Centos 7, Ubuntu, RHEL or any other bistro.

Feel free to leave a comment if you face any issues.

Leave a Reply

Your email address will not be published. Required fields are marked *