当我在Git中使用bash自动完成时,它会不断向我展示我不再拥有的旧遥控器的分支.当我这样做时,git branch -la它会显示那些旧的遥控器和分支,而git branch -l不会.A ls .git/refs/remotes/也显示了它们.但是,它们不存在于我的.git/config中,并且在我运行时它们都没有显示git remote show.
那么我如何摆脱它们,因为我的自动完成列表现在太长了.
我已经尝试过了:
git reflog expire --expire=now --all
git gc --prune=now
rm .git/refs/remotes/theoldremote
git remote prune theoldremote
Run Code Online (Sandbox Code Playgroud)
我也知道我可以重新克隆回购但这只是作弊;-)
我有2个远程分支:
- pending-issues-in-project
- new-issues-in-project
Run Code Online (Sandbox Code Playgroud)
我试图删除pending-issues-in-project这样:
git push origin :pending-issues-in-project,但我收到错误:
error: unable to push to unqualified destination: pending-issues-in-project
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@github.com:forkedRepo/RepoName.git'
Run Code Online (Sandbox Code Playgroud)
所以我想可能是我已删除pending-issues-in-project分支,但当我运行
git branch -a它显示pending-issues-in-project列表中的分支.
当我尝试相同(尝试删除)时new-issues-in-project,它工作.
我已经从本地服务器中删除了两个分支git branch -D branchName.
如果错误即将发生,因为存储库中不存在分支,那么为什么它会进入远程分支列表?
和
有什么办法来强制删除远程分支的?
谢谢你的时间.