Git 在 rebase 时显示旧已解决的提交上的 merge 冲突

标签 git rebase

我有一个现有的存储库,我需要更改所有提交的所有作者电子邮件(我是唯一处理该存储库的人)。

git rebase --root --exec 'git commit --amend --author="Arthur ATTOUT <<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="600e05174e050d01090c20030f0d10010e194e030f0d" rel="noreferrer noopener nofollow">[email protected]</a>>" --no-edit'

虽然前 100 次提交得到了正确处理,但在特定提交后,git 会崩溃并提示存在冲突

error: could not apply 0709cb2... Unit32 default value watermark
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 0709cb2... Unit32 default value watermark
Auto-merging ViewModels/ViewModels/DataprepControl.cs
CONFLICT (content): Merge conflict in ViewModels/ViewModels/DataprepControl.cs
me@home MINGW64 ~/source/repos/soft (dev|REBASE-i 129/320)

为什么 git 突然意识到那些 super 旧的提交存在冲突? rebase 不应该考虑我当时应用的冲突解决方案吗?

最佳答案

这可能是因为您尝试 rebase 的不是单个线性分支,而是包含多个 merge 点(来自已集成到主分支的附件分支)的事实。

当运行您启动的命令时,Git 会将他能找到的所有提交清除回存储库的根目录,然后一一重新应用它们,但不会保留结构。然后,您将失去迄今为止必须执行的所有 merge 决议。

您可能想看看git filter-branch

此外,如果您想要将所有作者重置为默认作者(您),请考虑使用 --reset--author 代替,它不需要有参数通过了。

关于Git 在 rebase 时显示旧已解决的提交上的 merge 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66029431/

相关文章:

git - 如何在 Windows 上的 Git Bash 中设置 rebase

Git Diff - 如何还原选定的行或 block

git - 如何将最后一次 git commit 编辑为补丁文件?

Git子模块更新被覆盖

Git:在一个命令中将一系列提交复制到其他提交,不涉及分支

Git:交互式地对一系列提交进行 rebase

git - 在一个 rebase 后 merge 来自相似分支的选定文件

java - 从 Git 存储库创建 Eclipse/Java 项目时遇到问题

git - 如何将我的十个提交从 master 移动到 git 中的一个新分支?

Git - 推送时自动 rebase