Tech TLDR;

  • Archive
  • Top Posts
  • GitHub
  • LinkedIn
  • Contact

How to Add Git Auto-Completion for the Command Line Tools in Mac OS X

July 14, 2016 by admin

Git supports auto-completion when used via the terminal, which includes all basic commands such as git status or git checkout as well as local and remote branch names etc.

It comes pre-installed on Ubuntu, but a few simple steps (bellow) have to be followed to get it working on Mac.

  1. Open up your terminal app
  2. Go to your home folder cd ~
  3. Download git completion source file from the official git repo curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash. Note: if this link goes dead, just google for the file name git-completion.bash and you should be able to find the updated link.
  4. Open your ~/.bash_profile file (on Mac) or ~/.bashrc file (on other platforms) with your favorite text editor. i.e. vim ~/.bash_profile
  5. Add the following line at the bottom of the file source ~/git-completion.bash and save the file.
  6. Close and re-open your terminal or run . ~/.bash_profile to re-load your setting.
  7. You should now have working git autocompletion in your terminal shell.

I initially learned this tip from Git Book, which I highly recommend to any new or intermediate Git users. You may also like my other posts on git – Git Cheatsheet and 19 Tips for Everyday Git Use.

Please let me know in the comment area if you run into any issues.

Filed Under: Git, Tools

Copyright © 2025 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in