Resolving Merge Conflicts in React Native: How to Address Conflicts in Pods, package-lock.json, yarn.lock, and project.pbxproj

Having trouble with merge conflicts in your React Native app with Pods, package-lock.json, yarn.lock, and project.pbxproj? I have the solution you’re looking for. These types of conflicts usually arise in React Native apps when one or both branches of code have installed a new node_module which uses native code, and then all sorts of conflicts will start to pop up in the Pods directory and project.pbxproj when you go to merge. The solution to fix these conflicts is to run $ pod deintegrate in both of your branches before doing your merge. This will take care of the majority of conflicts which tend to arise.

Then you’ll probably still have a few conflicts in package-lock.json, yarn.lock, and Podfile.lock. To fix the conflicts in package-lock.json or yarn.lock, you’ll want to checkout either branches package-lock.json or yarn.lock: $ git checkout name-of-your-branch — yarn.lock

For Podfile.lock, simply delete this file.

If there are any other conflicts which require manual resolution, go ahead and fix those. Then last, run $ pod install and then either $ npm install or $ yarn install. And boom! You’re back in business; merge conflicts resolved.

If you want to see every single terminal command from start to finish, please reference the 20 minute video above. Sometimes it’s hard to jot down every single step when it comes to doing something like this, so I find its helpful to just film everything for reference in case someone gets stuck on a particular step.