[英]Creating a new remote branch?
Quick sanity check - I wanted to create a new remote branch for myself. 快速健全性检查-我想为自己创建一个新的远程分支。 I want to do the following:
我要执行以下操作:
git clone git@github.com:orange/orange.git
git branch foo
git checkout foo
git push foo foo
I'd like to simply clone master, create a new branch named "foo" (using what was in master), then push it to a remote repo called "foo". 我想简单地克隆master,创建一个名为“ foo”的新分支(使用master中的内容),然后将其推送到一个名为“ foo”的远程仓库中。 Does the above do that?
以上是吗? The last line seems a little weird, in that I'm naming "foo" twice.
最后一行似乎有点怪异,因为我两次命名了“ foo”。
Thanks 谢谢
I think you are confused by the term "remote." 我认为您对“远程”一词感到困惑。 A remote is a repository that exists somewhere else.
远程是存在于其他地方的存储库。 A remote repository has branches;
远程存储库具有分支; these are called "remote branches."
这些称为“远程分支”。 If your goal is to push your local
foo
branch to the repository that you just cloned then: 如果您的目标是将本地
foo
分支推送到刚克隆的存储库,则:
git push origin foo
When you git clone
, Git creates a remote called origin
. 当您进行
git clone
,Git会创建一个称为origin
的远程目录。 So this is the remote you want to push to. 因此,这是您要推送的遥控器。 Your
git push
line assumes that there is a remote called foo
. 您的
git push
行假定存在一个名为foo
的远程对象。 If you have not explicitly created one, then it doesn't exist. 如果尚未显式创建一个,则该名称不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.