Home Interests Git

How to Set up Git Tab Completion

howchoo   (455)
November 26, 2023
3 minutes


Posted in these interests:


git • 5 guides

Tab completion, or auto-completion, is essential if you’re using Git on the command line. Tab completion is a nice feature of many shells that allows you to complete a word by hitting tab. In this case, we want to be able to use tab completion for things like branches and tags in git. Fortunately, setting it up is pretty simple.

1 – Download the git completion shell script

First, open a shell and navigate to your home directory because that’s where the script will reside.


Now download the git completion script using one of the following methods.

Using curl:

curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

Using wget:

wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

2 – Source the git completion file

source ~/git-completion.bash

In most cases, you’ll want to source this file automatically whenever you start a new shell. To do so, open your ~/.bashrc file and append the command from above. Once you save the file, all new shells will automatically source the file.

Note: The tilde (~) refers to your home directory.

3 – Try it out

Move to a git controlled directory and type:

git checkout <tab><tab>

You should see a list of all of the possible branches that can be checked out!


How to Display the Current git Branch on the Command Line

howchoo   (455)
August 24, 2023

When you’re using git routinely, it’s helpful to know which branch you’re currently on without having to type git status or git branch. Fortunately, there’s a convenient way to add your current git branch to your command line prompt. For help with remote branches, check out this guide on how to check out a remote branch. 1 – Open

Continue Reading


 455 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Discover interesting things!

Explore Howchoo's most popular interests.