How to do it...

To enable the completion feature, you need to run the source command on the completion file, which you can do by adding the following lines to your .bashrc or .zshrc file, depending on your shell and the location of the Git completion file:

if [ -f /etc/bash_completion.d/git-completion.bash ]; then
    source /etc/bash_completion.d/git-completion.bash
fi  

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.