简体   繁体   中英

Ios git merge conflict in xCode

I have two branches in my project, one is develop and other is master , accidently without merging develop into master I made app live and now I have two different versions on two different branches. Let's say 1.5 version on master and 1.6 on develop, now when I tried to merge these two branches git show merge conflicts in 3 different files,

  • .plist
  • .xcodeproj
  • .xcworkspace

after merge when I tried to open xCode project, it failed and show error "project cannot be load.." when tried to open files manually it just doesn't open in editText. I tried sublime editor but then again I couldn't locate conflict as there were a lot of lines of code.

If you want to replace master content with dev, you should:

  • do a merge from master to dev, keeping dev content
  • then do a trivial merge from dev to master

That is:

 git checkout dev
 git merge --ours master
 git checkout master
 git merge dev

You can resolve conflicts by keeping any version (keep mine or keep theirs) of this files as they save the xcode status but they don't have your code and should not have been tracked. But don't resolve the conflicts yourself, just choose one of the versions and the project should work.

You are having this problem because you should have created a .gitignore file in your repo before creating any other file to avoid having problems with files that your ide uses but don't have the code of your app.

To avoid problems from now on, you can create the git ignore file with this content and add it to the repo.

But there are files traked that should not be. So execute this commands:

git rm -r --cached .
git add .
git commit -m "use .gitignore file"

This will delete everything from the index and add the files again applying the gitignore rules.

Check that all is working and git push to your server and you should not have more conflicts with this files for saving the xcode status.

Hello @Najam you can make change in remote branch push it to master and then try to merge remote and master

git merge remote mater:master

or you can delete the remote branch and push your remote code to master branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM