简体   繁体   English

Xcode 4 中 Git 存储库的问题

[英]Problem with Git Repository in Xcode 4

In my iPhone app, I am using the in-built Git repository of Xcode 4 so that all the team members can work on the same project.在我的 iPhone 应用程序中,我使用 Xcode 4 的内置 Git 存储库,以便所有团队成员都可以处理同一个项目。

Now the problem is that even after I commit my changes to the repository, It still shows modified (M) symbol in front of the committed file.现在的问题是,即使在我将更改提交到存储库之后,它仍然在提交的文件前面显示修改后的 (M) 符号。

What could be wrong?有什么问题?

I want to ensure that once I commit the changes it should not show "M" for that file.我想确保一旦我提交更改,它就不应该为该文件显示“M”。

Is there any setting which I have to do to make it work fine?有没有我必须做的设置才能让它正常工作?

What can be done?可以做什么?

The built-in Git repository is a local repository only.内置的 Git 存储库仅是本地存储库。 How do you share that with your team?你如何与你的团队分享这一点? If you hooked that repository to GitHub, for example, you will experience problems as the implementation is not 100% reliable.例如,如果您将该存储库连接到 GitHub,您将遇到问题,因为实现不是 100% 可靠的。 I would use the command line in this case and git add/commit/push the changes.在这种情况下,我将使用命令行并使用 git 添加/提交/推送更改。 There are discussions and tutorials in the GitHub Blog . GitHub 博客中有讨论和教程。

Without knowing what you're doing in Xcode, or how you have set up your repository all I can say is that you should check the status of your repository in the command line.在不知道您在 Xcode 中做什么,或者您如何设置存储库的情况下,我只能说您应该在命令行中检查存储库的状态。 Maybe your commit fails for some reason and you're not seeing the message in Xcode.也许您的提交由于某种原因而失败,并且您没有在 Xcode 中看到该消息。

  • Try git status to see what state your repository is in.尝试git status以查看您的存储库在哪个 state 中。
  • Try git add <your files> and then git commit to see if you can actually commit your changes.试试git add <your files>然后git commit看看你是否真的可以提交你的更改。

Did you stage your files before committing ( git add )?您是否在提交之前暂存文件( git add )? Otherwise the commit will do nothing.否则提交将什么也不做。

You would need to Push the changes in Xcode 4 to remove the "M" or modified status.您需要推送 Xcode 4 中的更改以删除“M”或修改状态。 If you don't have the command line mojo like most people, you can just use the functions built in as they were intended.如果您不像大多数人那样拥有命令行魔咒,您可以按照预期使用内置的功能。

It won't solve your issue of sharing as it is only a local repo.它不会解决您的共享问题,因为它只是一个本地存储库。 I'm finding that even using Xcode 4 with an outside repo, you need to learn some command line stuff or it just isn't going to work, or at the very least kick your butt enough to make you consider giving it up.我发现即使将 Xcode 4 与外部存储库一起使用,您也需要学习一些命令行的东西,否则它就行不通,或者至少足够让您考虑放弃它。

*edit Just to make it clear, the process for Xcode 4 is as follows: File-->Source Control-->Commit File-->Source Control-->Push *edit 说清楚一点,Xcode 4 的流程如下: File-->Source Control-->Commit File-->Source Control-->Push

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

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