git是否有可能在没有推送的情况下创建一个新的空的远程分支? [英] Is it possible in git to create a new, empty remote branch without pushing?
问题描述
创建远程分支的大多数示例都涉及从本地分支推送
有没有一种方法可以在不推动的情况下创建空的远程分支?
是否也可以创建一个本地空分支,检查出它,然后将其链接到新的也是空的远程分支而不用推送?
正如博客文章在你的远程Git仓库上启动一个新的分支:
- 创建远程分支
git的推起源来源:参考文献/头/ new_feature_name
- 确保所有内容都是最新的
git fetch origin
- 然后您可以看到该分支已创建。
git分支-r
这应该显示'
origin / new_feature_name
'
- 开始追踪新分行
git的结帐--track -b new_feature_name原点/ new_feature_name
因此,为了声明一个远程分支,即使是在 local 存储库中还没有的分支, git push
是强制性的。
Most examples of creating remote branches involve pushing from a local branch
Is there a way of creating an empty remote branch without pushing?
Is it also possible to create a local empty branch,check it out then link it to the new also empty remote branch without pushing?
As mentioned in the blog post "Start a New Branch on your Remote Git Repository":
- Creating a Remote Branch
git push origin origin:refs/heads/new_feature_name
- Make sure everything is up-to-date
git fetch origin
- Then you can see that the branch is created.
git branch -r
This should show ‘
origin/new_feature_name
’
- Start tracking the new branch
git checkout --track -b new_feature_name origin/new_feature_name
So to declare a remote branch, even one which doesn't yet exist on the local repository, git push
is mandatory.
这篇关于git是否有可能在没有推送的情况下创建一个新的空的远程分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!