Do you still have a remote branch named 2-dev-inprogress
? If so you have to remove this branch or prevent git-completion of remote branches by commenting out the remote checks in /etc/bash_completion.d/git
What's the most proper way to remove an already deleted branch from tab-completion history?
-
29-11-2021 - |
Question
I can't exactly remember the events that led me to my current scenario, but it happened something similar to this:
- had a branch named
2-dev-inprogress
- changed branch name of
2-dev-inprogress
to2-dev-wip
using:git branch -mv 2-dev-inprogress 2-dev-wip
My problem is that when i am in another branch and want to checkout 2-dev-wip
by using tab-completion (as usual), it only completes 2-dev-
, and gives me two options:
2-dev-inprogress
2-dev-wip
Anybody out there know some specific surgery to remove that 2-dev-inprogress
branch from tab-completion history? Only thing I've tried so far is commenting out source ~/.git-completion.bash
in my .bash_profile and restart iTerm, but no luck. I also snooped around the .git directory, but got scared thinking I would fudge something up beyond repair.
Solution 2
OTHER TIPS
The accepted answer makes sense, but did not work in my situation. If the remote branch no longer exists, then you may additionally need to prune. I used Seth Robertson's suggestion to clean up my system and get rid of many branches all at once: git remote | xargs -n1 git remote prune
. This can happen if another person deleted the remote branch(es) or in my case if you did it from another machine.