[英]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, 假设主版为1.5版本,开发版为1.6,现在当我尝试合并这两个分支时git show将冲突合并到3个不同的文件中,
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. 合并后,当我尝试打开xCode项目时,尝试失败并显示错误“无法加载项目..”,当尝试手动打开文件时,它只是无法在editText中打开。 I tried sublime editor but then again I couldn't locate conflict as there were a lot of lines of code. 我尝试了sublime编辑器,但是由于有很多代码行,所以我再也找不到冲突了。
If you want to replace master content with dev, you should: 如果要用dev替换主内容,则应该:
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. 您可以通过保留此文件的任何版本(保留或保留它们的版本)来解决冲突,因为它们保存了xcode状态,但是它们没有您的代码并且不应被跟踪。 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. 您遇到了这个问题,因为您应该在创建任何其他文件之前在您的存储库中创建一个.gitignore文件,以避免ide使用但没有应用代码的文件出现问题。
To avoid problems from now on, you can create the git ignore file with this content and add it to the repo. 为了避免现在出现问题,您可以使用此内容创建gitignore文件并将其添加到仓库中。
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. 这将从索引中删除所有内容,并应用gitignore规则再次添加文件。
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. 检查所有工作是否正常,并将git push
到您的服务器,并且该文件与保存xcode状态的文件不应有更多冲突。
Hello @Najam you can make change in remote branch push it to master and then try to merge remote and master 您好@Najam,您可以在远程分支中进行更改,将其推送到master,然后尝试将remote和master合并
git merge remote mater:master
or you can delete the remote branch and push your remote code to master branch. 或者您可以删除远程分支并将远程代码推送到master分支。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.