我添加了一个 Remote ,这样我就可以查看同事的代码。
$ git remote add coworker <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1d7a74695d72686f7a74696e786f6b786f3371727e7c71" rel="noreferrer noopener nofollow">[email protected]</a>:...
$ git fetch coworker
$ git checkout coworker/theirbranch
$ git checkout -b mycopy
代码看起来不错。所以我做了一些清理:
$ git checkout master
$ git remote remove coworker
$ git branch -D mycopy
但是他们的远程分支仍然出现:
$ git branch -a
remotes/coworker/theirbranch
我已经完成了git fetch -p --all
, git gc --prune=now
而那些却什么也没做。
我做不到 git branch -D coworker/theirbranch
因为 Remote 不存在。我也不能git fetch -p coworker
因为那个 Remote 不存在。
有什么想法吗?
最佳答案
gitmoteremovecoworker
应该删除了相应的远程跟踪分支,并且在我运行的快速测试中确实如此,所以我不确定这里出了什么问题.
不过,要手动清理,您可以在每个剩余的远程跟踪分支上运行 gitbranch -d -r
(注意这两个标志):
git branch -d -r coworker/theirbranch
关于git - 移除了 Remote 。但远程分支仍然显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43058470/