使用git管理xcodeproj文件 - 如何管理分支的配置 [英] Managing xcodeproj file with git -- how to manage the configuration for branches

查看:75
本文介绍了使用git管理xcodeproj文件 - 如何管理分支的配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用git,并基于其他人的建议,我已经开始在命令行中使用它,而不是从xcode中使用它。在最初提交我的项目文件夹后,我看到几个文件被自动排除,包括.xcodeproj文件。我添加了该文件并收到此错误:

  E325:注意
通过名称.git找到交换文件/.COMMIT_EDITMSG.swp
...
进程ID:8453(仍在运行)
打开文件.git / COMMIT_EDITMSG
日期:Thu Dec 8 08:21 :00 2011
比交换文件更新!

(1)另一个程序可能正在编辑同一个文件。
如果是这种情况,请注意不要在进行更改时最终得到同一个文件的两个
不同实例。
退出,或继续谨慎操作。

(2)此文件的编辑会话崩溃。
如果是这种情况,请使用:recover或vim -r .git / COMMIT_EDITMSG
来恢复更改(请参阅:帮助恢复)。
如果您已经这样做了,请删除交换文件.git / .COMMIT_EDITMSG.swp
以避免此消息。

交换文件.git / .COMMIT_EDITMSG.swp已经存在!
[O] pen只读,(E)dit,(R)ecover,(Q)uit,(A)bort:

我不知道这一切意味着什么,但是这发生在Xcode正在运行且未运行时,所以关于编辑文件的另一个程序的部分似乎不是问题。

当我想到这个时,我开始想知道如何在分支时管理项目配置的归档?如果我不存档项目文件,我想象这些分支都使用单个项目文件。这看起来不正确。所以我的问题是我如何管理分支的配置?

解决方案

该错误由 vim ,我认为它是你的编辑器。它表明 vim 认为 vim 的另一个副本已经在运行并且正在编辑文件。 git / .COMMIT_EDITMSG (这是git用于在提交时准备提交消息的文件)。杀死 vim 可能会在编辑此文件时将交换文件留下,导致此问题。也有可能你确实有另外一个 vim 运行的实例,编辑这个文件。如果是前者,则可以选择(R)ecover,该文件读取交换文件并使用该文件填充编辑器或无论如何(忽略交换文件)。如果你有另外一个 vim 运行的副本,那么你可能应该用(Q)uit或者(A)bort来取消这个<$ c $的实例c> vim 。



至于归档项目文件(我假设在git中进行跟踪),您绝对应该对它进行跟踪。一旦它被追踪,那么每个分支都会有自己的副本,这是正确的。


I am using git for the first time, and based on advice from others, I have started using it from the command line rather than from within xcode. After initially committing my project folder, I saw that several files were automatically excluded, including the .xcodeproj file. I added that file and received this error:

E325: ATTENTION
Found a swap file by the name ".git/.COMMIT_EDITMSG.swp"
...
       process ID: 8453 (still running)
While opening file ".git/COMMIT_EDITMSG"
            dated: Thu Dec  8 08:21:00 2011
     NEWER than swap file!

(1) Another program may be editing the same file.
   If this is the case, be careful not to end up with two
   different instances of the same file when making changes.
   Quit, or continue with caution.

(2) An edit session for this file crashed.
   If this is the case, use ":recover" or "vim -r .git/COMMIT_EDITMSG"
   to recover the changes (see ":help recovery").
   If you did this already, delete the swap file ".git/.COMMIT_EDITMSG.swp"
   to avoid this message.

Swap file ".git/.COMMIT_EDITMSG.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: 

I don't know what all this means, but this occurs when Xcode is running and when it is not running, so the part about another program editing the file seems to not be the problem.

As I thought about this, I began to wonder how do I manage the archiving of the project configuration when I am branching? If I don't archive the project file, I imagine that the branches are all using a single project file. This doesn't seem right. So my question is how do I manage the configuration for branches?

解决方案

That error is being reported by vim, which I assume is your editor. It indicates that vim believes that another copy of vim is already running and editing the file .git/.COMMIT_EDITMSG (which is the file that git uses to prepare the commit message when you're making a commit). It's possible that killing vim while it's editing this file would leave the swap file behind, causing this issue. It's also possible that you really do have another instance of vim running, editing this file. If it's the former, you can either "(R)ecover", which reads the swap file and uses that to populate the editor or "(E)dit anyway", which ignores the swap file. If you do have another copy of vim running then you should probably "(Q)uit" or "(A)bort" to cancel out of this instance of vim.

As for "archiving" the project file (which I assume means tracking in git), you absolutely should have it tracked. And once it's tracked, then each branch will have its own copy, which is right and proper.

这篇关于使用git管理xcodeproj文件 - 如何管理分支的配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆