Xcode: 在 GIT 子分支中添加文件,现在尝试向上合并给定,"Tree Conflict"
Xcode: Added file in GIT sub-branch, now attempts to merge upward give, "Tree Conflict"
我只在 Xcode 8.2.1 中使用本地存储库。这是一场单人秀,我是唯一一个修改代码的人。这些年来,我在GIT中创建了一系列子b运行ches如下:
master
branch1
...
branch14
branch14.1
...
branch 14.13 //added lots of new code/classes
branch 14.13.NewCombatReports //refactor 1 class into 2
在 14.13 中,我通过使用 xcode 的 "New File" 选项和创建新的 classes 添加了很多新的 classes。一旦我有了功能,我创建了一个子 b运行ch, 14.13.NewCombatReports,以隔离重构较大的 classes 之一(将一大块代码分成它自己的代码,新 class, BattleManager.m/h).
当我感到满意时,我提交了更改,然后尝试合并到父 b运行ch 中。我收到一条错误消息:
The operation could not be performed because of one or more tree conflicts. The files BattleManagerClass.h and BattleManagerClass.m had a tree conflict
按照类似 SO 问题的建议,我 运行 git status
在 BattleManager* 所在的同一目录中,返回:
On branch master.DevMain.14.13.newCombatReports
Untracked files:
(use "git add <file>..." to include in what will be committed)
../CloudKitHelperClass (xxxxxxxx's conflicted copy 2016-11-18).m
../yyyyyy.xcodeproj/project.xcworkspace/xcuserdata/thunk.xcuserdatad/.gitignore
../yyyyyy.xcodeproj/project.xcworkspace/xcuserdata/thunk.xcuserdatad/UserInterfaceState (xxxxxxxx's conflicted copy 2016-11-18).xcuserstate
../yyyyyy.xcodeproj/xcuserdata/thunk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
nothing added to commit but untracked files present (use "git add" to track)
None 其中似乎与新的 BattleManager class 有关。在四处徘徊之后,并没有真正理解我在 GIT 中所做的事情,我最终从 xcode 项目中删除了 class 并将 BattleManager 文件移至 ~/tmp。我提交了更改,然后成功地将 14.13.NewCombatReports 中的其余更改合并回 14.13。那时,我将新的 BattleManager class 重新添加回 14.13 并重建。一切都很好,或者我是这么想的。
当我随后尝试将 14.13 合并到 14 时,我遇到了一大堆树冲突,抱怨我在 14.13 中添加的每个 class 文件。
所以我显然做了一些根本性的错误,以至于 GIT 不喜欢它,当我尝试向上合并包含净新文件的 b运行 时。我不太了解GIT的工作原理,也不明白:
- 试图在本地存储库的上下文中告诉我什么是 "tree conflict" 错误? 我不明白我当前的修订与什么冲突。
- 如何修复它以便我可以向上合并这个包含新文件的 b运行ch?
这个问题似乎与 Xcode merge branch,remind tree conflict when add some new file. The comments link to: The operation could not be performed because "PROJECTNAME" has one or more tree conflicts 非常相似,它讨论的是尝试协调本地版本和服务器版本之间的目录结构。由于我不与服务器打交道,所以我不明白如何应用该建议。
我在 xcode 尝试 git 操作时看到过类似的奇怪失败。
关闭项目,退出 xcode 并重新启动已经为我解决了一些问题。
使用一种 gui git 工具有时也有帮助。有几个不同的选项,但我使用 gitbox 并且可以从应用程序商店获得。它有一个强制合并的选项,这可能会解决问题。
我只在 Xcode 8.2.1 中使用本地存储库。这是一场单人秀,我是唯一一个修改代码的人。这些年来,我在GIT中创建了一系列子b运行ches如下:
master
branch1
...
branch14
branch14.1
...
branch 14.13 //added lots of new code/classes
branch 14.13.NewCombatReports //refactor 1 class into 2
在 14.13 中,我通过使用 xcode 的 "New File" 选项和创建新的 classes 添加了很多新的 classes。一旦我有了功能,我创建了一个子 b运行ch, 14.13.NewCombatReports,以隔离重构较大的 classes 之一(将一大块代码分成它自己的代码,新 class, BattleManager.m/h).
当我感到满意时,我提交了更改,然后尝试合并到父 b运行ch 中。我收到一条错误消息:
The operation could not be performed because of one or more tree conflicts. The files BattleManagerClass.h and BattleManagerClass.m had a tree conflict
按照类似 SO 问题的建议,我 运行 git status
在 BattleManager* 所在的同一目录中,返回:
On branch master.DevMain.14.13.newCombatReports
Untracked files:
(use "git add <file>..." to include in what will be committed)
../CloudKitHelperClass (xxxxxxxx's conflicted copy 2016-11-18).m
../yyyyyy.xcodeproj/project.xcworkspace/xcuserdata/thunk.xcuserdatad/.gitignore
../yyyyyy.xcodeproj/project.xcworkspace/xcuserdata/thunk.xcuserdatad/UserInterfaceState (xxxxxxxx's conflicted copy 2016-11-18).xcuserstate
../yyyyyy.xcodeproj/xcuserdata/thunk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
nothing added to commit but untracked files present (use "git add" to track)
None 其中似乎与新的 BattleManager class 有关。在四处徘徊之后,并没有真正理解我在 GIT 中所做的事情,我最终从 xcode 项目中删除了 class 并将 BattleManager 文件移至 ~/tmp。我提交了更改,然后成功地将 14.13.NewCombatReports 中的其余更改合并回 14.13。那时,我将新的 BattleManager class 重新添加回 14.13 并重建。一切都很好,或者我是这么想的。
当我随后尝试将 14.13 合并到 14 时,我遇到了一大堆树冲突,抱怨我在 14.13 中添加的每个 class 文件。
所以我显然做了一些根本性的错误,以至于 GIT 不喜欢它,当我尝试向上合并包含净新文件的 b运行 时。我不太了解GIT的工作原理,也不明白:
- 试图在本地存储库的上下文中告诉我什么是 "tree conflict" 错误? 我不明白我当前的修订与什么冲突。
- 如何修复它以便我可以向上合并这个包含新文件的 b运行ch?
这个问题似乎与 Xcode merge branch,remind tree conflict when add some new file. The comments link to: The operation could not be performed because "PROJECTNAME" has one or more tree conflicts 非常相似,它讨论的是尝试协调本地版本和服务器版本之间的目录结构。由于我不与服务器打交道,所以我不明白如何应用该建议。
我在 xcode 尝试 git 操作时看到过类似的奇怪失败。
关闭项目,退出 xcode 并重新启动已经为我解决了一些问题。
使用一种 gui git 工具有时也有帮助。有几个不同的选项,但我使用 gitbox 并且可以从应用程序商店获得。它有一个强制合并的选项,这可能会解决问题。