问题描述
我使用 git branch -d myBranch
来删除一个分支。然而,当我在master上尝试使用 git checkout
签出一个新分支时, myBranch
仍然出现在选项卡中-autocomplete。
I used git branch -d myBranch
to delete a branch. However, when I am on master and try to checkout a new branch with git checkout
, myBranch
still appears in the tab-autocomplete.
如何为 git从tab-autocomplete中删除名称
? myBranch
checkout
How do I remove the name myBranch
from tab-autocomplete for git checkout
?
推荐答案
一个可能的原因是,如果远程分支(例如 origin / myBranch
)仍然存在,那么 git checkout myBranch
会成功替代 git checkout - b myBranch起源/ myBranch
。这是为了第一次结帐远程分支的常见情况,创建一个名称相同的本地跟踪分支的便利。
One possible reason for this is that, if a remote branch (e.g. origin/myBranch
) still exists, then git checkout myBranch
will succeed as an alternative to git checkout -b myBranch origin/myBranch
. This is intended as a convenience for the common case of checkout out a remote branch for the first time, creating an identically named local tracking branch.
还有其他可能性,这取决于你完成的是什么,但这是我要检查的第一件事情之一。如果运行 git branch -a
,并且列出了 origin / myBranch
(或者一个用于远程以外的 origin
,如果有的话),那么这可能是罪魁祸首。
There are other possibilities, too, depending on what exactly you are using for completion, but that's one of the first things I'd check. If you run git branch -a
, and there is an origin/myBranch
listed (or one for a remote other than origin
, if you have such), then that's a likely culprit.
这篇关于如何从自动完成中删除已删除的分支名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!