git
config_error
ai_generated
true
致命错误:名为'feature/new-ui'的分支已存在
fatal: A branch named 'feature/new-ui' already exists.
ID: git/rename-branch-conflict
80%修复率
83%置信度
1证据数
2023-11-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| git 2.42.0 | active | — | — | — |
| git 2.43.0 | active | — | — | — |
| git 2.44.0 | active | — | — | — |
根因分析
尝试创建或重命名分支到已存在的分支名称
English
Attempting to create or rename a branch to a name that already exists in the repository.
官方文档
https://git-scm.com/docs/git-branch解决方案
-
Delete the existing branch first if safe: git branch -D feature/new-ui && git branch -m old-name feature/new-ui
-
Force push the renamed branch after local rename: git push origin --delete feature/new-ui && git push origin feature/new-ui
无效尝试
常见但无效的做法:
-
Using 'git branch -m old new' when 'new' already exists on remote
80% 失败
Local rename does not check remote; push will fail with non-fast-forward
-
Deleting the local branch with 'git branch -D new' then trying to rename
70% 失败
Remote branch still exists; push will still fail