Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8 source control does not show conflicts

After Xcode has updated to version 8.0 (8A218a), I have a problem pulling changes from git repository from Xcode only when some files are conflicted. We are all working on the same branch.

As long as there are no conflicts, everything works perfectly and I am able to commit, pull and push.

But I figured out that whenever we have a conflict in some of the files, Xcode is not showing conflicts anymore. It just closes the pull popup window without showing the conflict resolver window. No info or anything. I don't see the

Pull successful

message. And I can't push my commit (because changes are not pulled) getting the message:

Make sure all changes have been pulled from the remote repository and try again

I have tried pulling using terminal, but the conflicted file gets messed up with git messages showing mine and other people changes in the same conflicted file along those git messages. And the files that other people were working on are now shown as my own changes/additions.

I also tried updating git to the newest version, which is currently 2.10.0. No luck either.

So I end up deleting my copy and cloning the latest one and reapplying changes that i've made which is very annoying.

Does anyone have a solution for this?

EDIT: Here is what you can do as a workaround using the terminal:

  1. Open terminal and tell the system where Xcode utilities live:

    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 
  2. Set "opendiff" as the default mergetool globally:

    git config --global merge.tool opendiff 
  3. Open Xcode mergetool manually and get rid of the conflict the usual way:

    git mergetool 
  4. Save changes, commit, push.

like image 383
Despotovic Avatar asked Sep 19 '16 18:09

Despotovic


People also ask

How do I see conflicts in Xcode?

Show activity on this post. Then, when git tells you that there is a conflict, you can run git mergetool and it will open XCode's mergetool (like in the question's screenshot) and you can work through the conflict.

How do I enable source control in Xcode?

Choose Xcode > Preferences > Accounts, click the Add button (+), select the type of account to add, and click Continue. In the dialog that appears, click the “Create a Token on [Source Control Platform]” button if you don't have a token already.


1 Answers

I use git in Terminal to solve this problem, mergetool is used. Fisrt, I pull some changes, but oops, not up to date:

git fetch origin git pull origin master  From ssh://[email protected]:22/projectname  * branch            master     -> FETCH_HEAD Updating a030c3a..ee25213 error: Entry 'filename.c' not uptodate. Cannot merge. 

So get up-to-date and try again, but have a conflict:

git add filename.c git commit -m "made some wild and crazy changes" git pull origin master  From ssh://[email protected]:22/projectname  * branch            master     -> FETCH_HEAD Auto-merging filename.c CONFLICT (content): Merge conflict in filename.c Automatic merge failed; fix conflicts and then commit the result. 

So I decide to take a look at the changes:

git mergetool 

use mergetool to merge the conflict

changes...no...their changes... git checkout --ours filename.c git checkout --theirs filename.c git add filename.c git commit -m "using theirs" 

And then we try a final time

git pull origin master  From ssh://[email protected]:22/projectname  * branch            master     -> FETCH_HEAD Already up-to-date. 

answer from:How to resolve merge conflicts in Git?

like image 156
Wayne Chen Avatar answered Oct 13 '22 09:10

Wayne Chen