我在使用 git pull origin SomeBranch 时遇到了问题,因为当存在冲突时,有时我无法在 Xcode 中打开文件来解决冲突。
根据我的阅读,虽然我可能是错的,但我认为 git fetch 会抓取代码,但不会像 git pull 那样 merge 它。这如何与 Xcode 配合使用?
例如,在 Branch1 上的一台计算机上,我进行了一些更改。
然后在机器 2 上的 Branch2 上,我想获取 Branch1 的更改。
所以我这么做了
git fetch origin Branch2
我的命令行输出是:
*branch Branch2 -> FETCH_HEAD
这是什么意思?当我转到我更改的文件的源文件时,我没有看到任何更改。
我认为 Xcode 中会发生什么,然后它会显示该源文件中该文件的更改,然后该文件将被修改。只有当我提交时,它才会被添加到暂存区域,这样我就可以将它与其他所有内容 merge 。但也许我理解不正确。想法?谢谢。
最佳答案
I thought git fetch grabs the code but does not merge it yet like git pull does.
是的,这是正确的。 git merge
是更新你的工作目录的东西,这就是为什么......
When I go to the source file of the file that I changed, I do not see any changes made.
git fetch
检索表示更改的对象,但不会更新您的工作目录。这就是 git merge
的作用。请记住,git pull
基本上是 git fetch
后跟 git merge
。
关于iphone - 使用 Xcode 进行 git fetch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11961315/