What is the best way to remove an already deleted branch from the tab completion history?

I can’t remember exactly the events that led me to my current scenario, but it happened something like this:

  • had a branch named 2-dev-inprogress
  • changed the name of the 2-dev-inprogress to 2-dev-wip using:
    • git branch -mv 2-dev-inprogress 2-dev-wip

My problem is that when I am in a different branch and want to check 2-dev-wip using tabs (as usual), it completes only 2-dev- and gives me two options:

  • 2-dev-inprogress
  • 2-dev-wip

Does anyone know of a specific operation to remove the 2-dev-inprogress from the tab completion history? The only thing I've tried so far is to comment on source ~/.git-completion.bash in my .bash_profile and reload iTerm, but no luck. I also looked into the .git directory, but was scared, thinking that I could do something without repair.

+7
source share
2 answers

Do you still have a remote branch named 2-dev-inprogress ? If so, you need to remove this branch or prevent the git component of the remote branches by commenting on remote checks in / etc / bash_completion.d / git

+1
source

The accepted answer makes sense, but does not work in my situation. If the remote branch no longer exists, you can trim it further. I used Seth Robertson's suggestion to clean my system and get rid of many branches right away: git remote | xargs -n1 git remote prune git remote | xargs -n1 git remote prune . This can happen if another person deleted the deleted branches (branches), or in my case, if you did this from another computer.

+6
source

All Articles