Xcode 8 源代码管理不显示冲突

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39579893/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:17:05  来源:igfitidea点击:

Xcode 8 source control does not show conflicts

xcodegitversion-controlxcode8

提问by Despotovic

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

在 Xcode 更新到版本 8.0 (8A218a) 后,只有当某些文件发生冲突时,我才会从 Xcode 从 git 存储库中提取更改。我们都在同一个分支上工作。

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 conflictsanymore. It just closes the pull popup window without showing the conflict resolver window. No info or anything. I don't see the

但是我发现每当我们在某些文件中出现冲突时Xcode 就不再显示冲突了。它只是关闭拉弹出窗口而不显示冲突解决程序窗口。没有信息或任何东西。我没有看到

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.

我曾尝试使用terminal 进行拉取,但是冲突的文件被 git 消息弄乱了,这些 git 消息显示我和其他人在同一个冲突文件中沿着这些 git 消息进行了更改。其他人正在处理的文件现在显示为我自己的更改/添加。

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

我还尝试将 git 更新到最新版本,目前是 2.10.0。也没有运气。

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.

  1. 打开终端并告诉系统 Xcode 实用程序所在的位置:

    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
    
  2. 将“opendiff”设置为全局默认合并工具:

    git config --global merge.tool opendiff
    
  3. 手动打开 Xcode 合并工具并以通常的方式摆脱冲突:

    git mergetool
    
  4. 保存更改、提交、推送。

回答by Wayne Chen

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

我在终端中使用git来解决这个问题,使用了mergetool。首先,我进行了一些更改,但是哎呀,不是最新的:

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

使用mergetool合并冲突

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?

答案来自:如何解决 Git 中的合并冲突?

回答by Karthick Vadivel

Please update to Xcode 8.2.1

请更新到 Xcode 8.2.1

I had the same problem.But it is resolved once I have updated my Xcode version to 8.2.1.

我有同样的问题。但是一旦我将我的 Xcode 版本更新到 8.2.1,它就解决了。

I have resolved all the conflicts today,which I was facing with Xcode Version 8.1.

我已经解决了今天在 Xcode 8.1 版中遇到的所有冲突。

回答by Arik Segal

The following sequence of actions resolves this problem:

以下操作序列可解决此问题:

Exit Xcode

退出Xcode

Open Terminal and cd to the project's folder

打开终端并 cd 到项目的文件夹

git checkout -- .

git 结帐 -- 。

git pull

Look at the output of the pull command. It should announce that there is a conflict in one of the files. Open this file in an external editor (not Xcode). The file should now contain special markers describing the conflict (they were added by GIT) The markers look like this:

查看 pull 命令的输出。它应该宣布其中一个文件存在冲突。在外部编辑器(不是 Xcode)中打开此文件。该文件现在应该包含描述冲突的特殊标记(它们是由 GIT 添加的)标记如下所示:

<<<<<<< HEAD:file.txt
Hello world
=======
Goodbye
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

Delete the markers and resolve the conflict

删除标记并解决冲突

git add [file name]

git add [文件名]

git commit -m "conflict in [file name] resolved"

git commit -m “[文件名] 中的冲突已解决”

git push

回答by dory daniel

update your Xcode to the latest version and make sure your partners have the same one too

将您的 Xcode 更新到最新版本,并确保您的合作伙伴也拥有相同的版本

回答by Marin Bencevic

Happens to me still in Xcode 8.1, using Github.

仍然在 Xcode 8.1 中使用 Github 发生在我身上。

Doing git fetchin the terminal, and then pulling from Xcode again seems to fix the issue for me.

git fetch终端,然后在Xcode再次拉似乎解决这个问题对我来说。