迁移到新的 git 远程时出错;某些分支的 git-lfs 已被删除,但并非全部。我们有功能相似的分支,但在根部却有所分歧。 那就是
分行1 A-B-C-D-E-F
分行2 A'-B'-C'-X-Y-Z
其中 prime(') 提交是相同的,除了 lfs 及其父级的哈希值。请注意,大约有 60000 次提交,并且在分支 1 中继续开发了一段时间。
现在的任务是将 X-Y-Z 提交合并到分支 1。
天真的第一次尝试 git-merge 因冲突数量过多而失败。 gitcherry-pick 可以工作,但我们不确定是否可以识别所有相关的提交。
有更好的方法吗?
也许是一种策略或合并驱动程序?
现在的任务是将 X-Y-Z 提交合并到分支 1。
所以你想最终得到
分支1
A-B-C-D-E-F-X-Y-Z
,对吧?
然后这是使用
--onto
参数的直接变基:
git branch Branch_2.tmp Branch_2 # Keep Branch_2 as is (for now at least)
git rebase --onto Branch_1 C' Branch_2.tmp # Rebase commits from (NOT including) C' to
# (including) the head of (old) Branch_2.tmp
# on top of Branch_1 and then let (new)
# Branch_1.tmp point to the result.
git checkout Branch_1
git merge --ff Branch_1.tmp
git branch -d Branch_1.tmp