gpt4 book ai didi

git - 我如何 git remote prune 只是一个特定的远程分支?

转载 作者:太空狗 更新时间:2023-10-29 14:44:05 24 4
gpt4 key购买 nike

我的一个同事“重用”了一个分支名称,所以每次 pull 时,我都会收到一条错误消息:

error: 'refs/remotes/origin/branch' exists; cannot create 'refs/remotes/origin/branch/subbranch'
...
error: some local refs could not be updated; try running
'git remote prune origin' to remove any old, conflicting branches

问题是,我不想进行大规模的远程修剪 - 我很偏执,我想保留这些本地引用资料,以防其他同事以新的和有趣的方式搞砸。

有没有一种方法可以只修剪有问题的分支,而不同时修剪所有其他在我的本地存储库中愉快地作为远程引用的分支?

最佳答案

看起来你可以专门删除本地引用分支,如果你使用git branch-r选项:

git branch -r --delete origin/branch

在此之后,可以适本地创建新分支,并且可以无错误地进行抓取和 pull 。 (并且 git remote prune --dry-run origin 仍然报告要修剪的分支。)

关于git - 我如何 git remote prune 只是一个特定的远程分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39047947/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com