Xcode 4 git集成 [英] Xcode 4 git integration

查看:132
本文介绍了Xcode 4 git集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,
我现在正在使用Xcode 4几个星期。来自Xcode 3并且看到所有新功能真是太好了。我喜欢git集成。但是我有这个问题。
我使用本地git存储库开始的最新项目。这一切工作正常,我做了多次提交。我想获得我的项目的旧版本。所以我尝试使用Pull。但是,只要我点击那个按钮,我会收到以下消息:

 操作无法执行,因为访问存储库/ Users / *** / Desktop / TestClone被拒绝。 

请检查您的姓名和密码,然后重试。

问题是,我没有在任何地方定义名称和密码。我怎样才能在我的项目中获得一个州的副本?
结帐按钮始终显示为灰色,因此我无法点击该按钮。



任何帮助将不胜感激。 :-D

解决方案

您不应该使用'pull ...'命令来返回您的代码的较旧版本。
$ b

'pull'和'push'命令用于将本地存储库与原始远程存储库进行同步。此功能通常用于克隆原始远程存储库,以便与其他程序员协调更改。



如果您从头开始创建项目,没有任何远程存储库可以推送或从中提取。



回到原始问题,据我所知,Xcode 4不会让您签出更旧的提交在用户界面中,除非您为该提交创建了新的分支。不过,你可以通过命令行来完成。为此,请在项目文件夹中使用以下命令:

  $ git log --format = oneline 

以获得您想要提交的提交的哈希码,然后使用:

  $ git checkout desired-hash-code 

来检出特定的版本。一旦出现,您可以进行测试,更改,并可能创建一个新的分支。如果您在不创建新分支的情况下执行提交,那么您将失去当前分支中较新的提交。如果您想在旧版本中执行一些测试后回到最新的提交中,请使用:

  $ git checkout master 

再次注意,如果您从旧代码版本进行新提交而不创建新分支,因为当前分支中的新提交得到解除引用。



如果您是Git的新手,我会阅读以下任何文档:



我也想强调这两点:





干杯。


Hey, I'm now using Xcode 4 for a few weeks. It's just great to come from Xcode 3 and see all the new features. I like the git integration. But I have the one and other problem with that. The newest project I started with a local git repository. That all works fine and I did multiple commits. I want to get an older version of my project. So I try to use Pull. But as soon as I click that button, I get the following message:

The operation could not be performed because access to the repository "/Users/***/Desktop/TestClone" was denied.

Check your name and password and try again.

The problem is, I didn't define anywhere a name and a password. How can I get a copy of a state in my project? The checkout button is always grayed out so I can't click that one.

Any help would be appreciated. :-D

解决方案

You should not use the 'pull...' command for "going back to" (checking out) an older version of your code.

The 'pull' and 'push' commands are used for synchronizing your local repository with an "origin" remote repository. This feature is normally used when you 'clone' an original remote repository in order to coordinate your changes with other programmers.

If you created your project from scratch, you won't have any remote repository to push to or pull from.

Back to the original question, as far as I know, Xcode 4 won't let you to checkout older commits within the user interface, unless you created a new branch for that commit. Nevertheless, you can do it from the command line. For that, use the following command from your project folder

$ git log --format=oneline

to get the hash code of the commit you want to go to, and then use:

$ git checkout desired-hash-code

to checkout that particular version. Once there, you can make tests, changes, and possibly create a new branch. If you do a commit without creating a new branch, you will lose the newer commits in your current branch. If you want to go back to the newest commit after having performed some tests on your older version use:

$ git checkout master

note again that this won't work if you do a new commit from your old code version without creating a new branch, because newer commits in the current branch get dereferenced.

If you are new to Git, I would read any of these documents:

I would also like to highlight these two:

Cheers.

这篇关于Xcode 4 git集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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