3

I have a branch release-x.x.x that I would like to merge into the master. However it has hundreds of merge conflicts when I do a pull request. I think this is due to a Swift 3 migration I performed. Either way I want to use all the versions of the files in release-x.x.x when merged into master. I have done checkout release-x.x.x and git merge -s recursive -X ours master. I am doing it in reverse so I can resolve conflicts on the release-x.x.x and then create a pull request on master and keep all the commit history.

When I run git status, this is some of the output:

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

I assume I want to keep anything with added by us, both added and also keep anything marked deleted by them, so I have staged these files. How do I deal with deleted by us and both deleted? If I try git rm Pods/FirebaseInstanceID/CHANGELOG.md I get the error: Pods/FirebaseInstanceID/CHANGELOG.md: needs merge. Am I on the right track here at all?

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
KexAri
  • 3,867
  • 6
  • 40
  • 80

1 Answers1

5

Yes, you're on the right track. To resolve the merge in the way you specified, you should git rm any files that are marked deleted by us or both deleted.

The needs merge error should be just a warning. When I run git rm <file> on a file deleted by one side in a merge, I get:

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

And a subsequent git status shows that the file has been deleted (and the deletion has been staged).

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67