我的一个同事“重用”了一个分支名称,所以每次我拉时,我都会收到一条错误消息:
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
Run Code Online (Sandbox Code Playgroud)
问题是,我不想进行大规模的远程修剪 - 我很偏执,我想保留这些本地引用,以防其他同事以新的和有趣的方式搞砸。
有没有一种方法可以只修剪有问题的分支,而不必修剪所有其他分支,这些分支很高兴作为本地存储库中的远程引用?
看起来您可以专门删除本地引用分支,如果您使用以下-r选项git branch:
git branch -r --delete origin/branch
Run Code Online (Sandbox Code Playgroud)
在此之后,可以适当地创建新分支,并且 fetch 和 pull 发生而不会出错。(并且git remote prune --dry-run origin仍然报告要修剪的分支。)
| 归档时间: |
|
| 查看次数: |
822 次 |
| 最近记录: |