When in a repository directory, use tab(Tab key on keyboard) to automatically complete Git commands and branches like normal bash commands.
How to get this working:
First you need to get
git-completion.bash
script (see it here) and put it in your home directory:Next, add the following lines to your .bash_profile. This tells the bash to execute the git branch script if it exists.
Note: You can use the file~/.bashrc
instead to make this method applicable to Linux.
Now when you change to a directory that is within a GIT repository, then you can use tab key to auto-complete the commands and branch names.