3

我有一个分支release-x.x.x,我想合并到 master 中。但是,当我执行拉取请求时,它有数百个合并冲突。我认为这是由于我执行了 Swift 3 迁移。无论哪种方式,我都想在release-x.x.x合并到master. 我已经完成了checkout release-x.x.xgit merge -s recursive -X ours master。我正在反向执行此操作,因此我可以解决冲突release-x.x.x,然后创建拉取请求master并保留所有提交历史记录。

当我运行时git status,这是一些输出:

added by us:     Pods/FirebaseCrash/Frameworks/frameworks/FirebaseCrash.framework/FirebaseCrash
added by us:     Pods/FirebaseCrash/Frameworks/frameworks/FirebaseCrash.framework/Headers/FIRCrashLog.h
added by us:     Pods/FirebaseCrash/Frameworks/frameworks/FirebaseCrash.framework/Headers/FirebaseCrash.h
added by us:     Pods/FirebaseCrash/Frameworks/frameworks/FirebaseCrash.framework/Modules/module.modulemap
deleted by them: Pods/FirebaseCrash/README.md
deleted by them: Pods/FirebaseCrash/batch-upload
deleted by them: Pods/FirebaseCrash/upload-sym
deleted by them: Pods/FirebaseCrash/upload-sym-util.bash
deleted by us:   Pods/FirebaseInstanceID/CHANGELOG.md
added by us:     Pods/Intercom/Intercom/Intercom.framework/Versions/A/Intercom
both added:      MyProject/Base.lproj/Localizable.stringsdict
both deleted:    MyProject/Localizable.stringsdict
both added:      MyProject/en-HK.lproj/Localizable.stringsdict

我假设我想保留任何东西added by usboth added并保留任何标记的东西deleted by them,所以我已经暂存了这些文件。我该如何处理deleted by usboth deleted?如果我尝试git rm Pods/FirebaseInstanceID/CHANGELOG.md我得到错误:Pods/FirebaseInstanceID/CHANGELOG.md: needs merge。我在正确的轨道上吗?

4

1 回答 1

5

是的,你在正确的轨道上。要以您指定的方式解决合并,您应该将git rm任何标记为deleted by us或的文件both deleted

needs merge错误应该只是一个警告。当我git rm <file>在合并中被一侧删除的文件上运行时,我得到:

<file>: needs merge
rm '<file>'

随后git status显示该文件已被删除(并且删除已上演)。

于 2016-10-20T17:46:22.813 回答