MacOS – Completion for git commands

auto-completegititermmacosterminal

I recently switched from using an Ubuntu box for the last 7 years to a Mac. I have read other posts like Switching from Ubuntu to OS X and I'm lost and What is the difference between iTerm2 and Terminal?

Why don't iTerm2 and Terminal complete the arguments for a command?

Eg. If I do gi+Tab, it autocompletes this word to git which is good. When I add a space and try remo+Tab, why don't I get it autocompleted to remote like in Ubuntu. I have to type everything manually after the word git. Same for other commands.

Am I doing something wrong, or missing something?

(Please note that I am not talking about the cmd + ; shortcut which autocompletes previously typed entries in iTerm2.)

Best Answer

The easiest way to get autocompletion on OS X is to switch your shell to zsh.

You can test things by running zsh in iTerm and terminal before making the switch above. If you really want to stick with bash you can start with these two questions: