I'm on a sort of frankendebian stretch/sid (not the best idea, I know; planning on reinstalling soon).
Tab completion works for git branch names in git repo directories:
:~/project $ git checkout <TAB><TAB>
Display all 200 possibilities? (y or n)
:~/project $ git checkout private-rl_<TAB><TAB>
private-rl_1219_misspelled_locale_zhtw private-rl_1950_scheduler_offset private-rl_bootstrap_rake_tasks
private-rl_1854_ldap_filter_reset private-rl_bootstrap_rake_task
But some of the branches it shows don't exist anymore:
:~/project $ git branch
* develop
private-rl_1219_misspelled_locale_zhtw
stable
This also happens for deleted remote branches.
What's going on here? Does the git completion script keep a cache of old branches that can be flushed somehow? How can I stop these branches from accumulating in my tab-completion results?
Best Answer
I figured it out, thanks to some gentle prodding from @PatrickMevzek:
The branches I was seeing were actually references to remote branches that had already been deleted. To quote the top answer from the SO thread linked above,
fixed it for me.