Search code examples
linuxgitterminal

Git - how to remove branch from checkout autocomplete


I've deleted some local branches via git branch -d branchname, but they are still exist in autocomplete (when I put git checkout, then press tab key, I see all deleted branches in list).

I've tried to make git gc and git prune, but nothing changes.


Solution

  • If you are sure that you do not want the branch, you can remove it from your local and the remote like this:

    $ git branch -D branchname
    $ git push origin :branchname
    

    Then it will stop appearing in autocomplete results.