Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make git checkout <tab> show only the branches I have locally

Tags:

git

bash

When I want to check a branch to checkout to and I don't remember the exact name, I can't use Tab-completion, as the pool it uses is the branch pool of remote.

How can I make the Tab only look at the git branch pool (i.e. only choose from the local branches I created / already checkedout)

like image 416
CIsForCookies Avatar asked Jan 28 '19 16:01

CIsForCookies


People also ask

Does git branch show local branches?

To see all local and remote branches, run this command: git branch -a.


1 Answers

One way is to modify the standard code completion script for git checkout, example (& credit) below:

https://gist.github.com/mmrko/b3ec6da9bea172cdb6bd83bdf95ee817

like image 84
be_es Avatar answered Sep 24 '22 02:09

be_es