简体   繁体   English

XCode git pull后的工作流程混乱

[英]workflow confusion after XCode git pull

I've used other DVCS systems before but I'm new to git. 我以前使用过其他DVCS系统,但我是git的新手。 So I think I have wrong assumptions about how to use it the way I intend. 所以我认为我对如何按照自己的意图使用它有错误的假设。

I have a RepoA which has a master and develop branch where I do the majority of my work. 我有一个RepoA,该仓库有一个master和development分支,负责我的大部分工作。 A while back, I cloned RepoB from RepoA to start working on "BigFeatureA" and also did this in the develop branch. 前一阵子,我从RepoA克隆了RepoB,开始从事“ BigFeatureA”的开发工作,并且还在开发分支中做到了这一点。 I'm not finished with BigFeatureA but want to bring over all the changes that have been made in RepoA since I did the clone so that I continue to work on BigFeatureA using the most up to date code. 我还没有完成BigFeatureA的工作,但想介绍自从完成克隆以来RepoA中所做的所有更改,以便我继续使用最新代码来处理BigFeatureA。 (At the moment in RepoA, the develop and master branches are the same but of course, sometimes they're not.) Using XCode working in RepoB, I did a Pull from RepoA develop branch. (目前在RepoA中,develop和master分支是相同的,但是当然有时是不同的。)使用在RepoB中使用XCode的方法,我从RepoA开发分支中进行了Pull。 I had a conflict, resolved it, Pull button enabled and then did the pull. 我发生冲突,解决了此问题,启用了“拉动”按钮,然后进行了拉动。

Now in RepoB, all the changes brought over are "uncommitted changes" and the files are showing "M's" or modified. 现在,在RepoB中,所有带来的更改都是“未提交的更改”,并且文件显示为“ M”或已修改。 So none of the commit messages or anything came over from RepoA, just the source changes. 因此,没有任何提交消息或任何东西都来自RepoA,只是源发生了变化。 This isn't what I expected. 这不是我所期望的。 Is this just XCode's version of git workflow or is this just how git merge works? 这仅仅是XCode的git工作流版本,还是git merge的工作方式?

My final workflow was to push RepoB to RepoA when BigFeatureA was done. 我的最终工作流程是在完成BigFeatureA之后将RepoB推送到RepoA。 Is there a difference between doing that and going the other direction, ie: be in RepoA and pulling from RepoB? 这样做和走另一个方向(即进入RepoA并从RepoB撤出)之间有区别吗?

(Further reading suggests that I probably should have created a "BigFeatureA" branch in RepoB and then done a pull from RepoA on the develop branch in there and then a merge from the BigFeatureA branch into the develop branch. Would there have been a difference doing a merge between branches vs repo's?) (进一步的阅读表明,我可能应该在RepoB中创建一个“ BigFeatureA”分支,然后从该仓库中的develop分支上的RepoA中拉出,然后从BigFeatureA分支合并到development分支中。这样做会有所不同吗?分支与回购之间的合并?)

No, this is not the expected behaviour. 不,这不是预期的行为。 The reason it was leaving all the changes as modified files was because it had "given up" on the merge. 之所以将所有更改保留为修改文件,是因为它在合并中“放弃了”。

Information that I did not know was relevant at the time of the posting -> I had created the repository originally not knowing about putting .DS_Store in the .gitignore file. 发布时我不知道的相关信息->我创建的存储库最初不知道将.DS_Store放在.gitignore文件中。 I have had *.DS_Store there for a long time, but I probably hadn't cleaned up properly after doing that. 我在那儿已经有* .DS_Store很长时间了,但是这样做之后我可能没有正确清理。 It looks like there were "many" .DS_Store files in the repository and putting it in the .gitignore file appears to just mean "from now forward", not "from what I did before". 似乎存储库中有“许多” .DS_Store文件,将其放入.gitignore文件似乎只是意味着“从现在开始”,而不是“从我之前所做的”。

So above, Xcode complained about the .DS_Store file being modified and since it didn't know how to resolve conflicts in files of that type, it just gives up. 因此,在上面,Xcode抱怨.DS_Store文件被修改,并且由于它不知道如何解决该类型文件中的冲突,因此它放弃了。 It didn't handle the fact that the file had been deleted already in RepoA, it needed to be deleted in RepoB too. 它不能处理文件已经在RepoA中删除的事实,它也需要在RepoB中删除。 Secondarily, although it said .DS_Store in the file list, it was not the .DS_Store in the main folder, it was one or more .DS_Store files somewhere down the file hierarchy. 其次,尽管在文件列表中显示了.DS_Store,但不是主文件夹中的.DS_Store,而是文件层次结构中某个位置的一个或多个.DS_Store文件。 So no matter how many times I deleted the top level .DS_Store in git via the command line, Xcode was never happy. 因此,无论我通过命令行在git中删除顶级.DS_Store多少次,Xcode都永远不会感到高兴。 So I couldn't tell which .DS_Store file it was talking about. 因此,我无法确定它在谈论哪个 .DS_Store文件。 Looks like Xcode is not good about having multiple files of the same name in your project. 看起来Xcode不太适合在您的项目中拥有多个相同名称的文件。

Fix is to follow another SO post where you find all the .DS_Store's in your hierarchy, git rm them and then git commit all via the command line. 解决的方法是按照另一篇SO帖子的介绍 ,在该帖子中 ,您可以找到层次结构中的所有.DS_Store,对它们进行git rm,然后通过命令行git commit全部。 Then the Xcode merge will complete and you won't be left with modified files from a pull. 然后,Xcode合并将完成,并且不会从下拉菜单中保留修改后的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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