如何在不创建本地分支的情况下创建远程Git分支? [英] How to create a remote Git branch without creating a local branch?
本文介绍了如何在不创建本地分支的情况下创建远程Git分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个新的远程分支供以后使用。
最常见的建议方式似乎是:
git checkout -b newbranch起点/起点
git push origin newbranch
但是,这也会在本地创建分支并将其放到它上面。有没有办法创建一个远程分支,而无需在本地创建并移动到它? 解决方案
在我看来,这有点武断。但它并不在乎本地ref是什么,你可以直接说出你推送的远程名称,所以:
git branch junkname origin / startingpoint
git push origin junkname:newbranch
git branch -d junkname
I'd like to create a new remote branch for later use. The most commonly suggested way seems to be:
git checkout -b newbranch origin/startingpoint
git push origin newbranch
But this will also create the branch locally and put me on it. Is there a way of creating a remote branch without creating it locally and moving onto it?
解决方案
push demands a local ref, though it seems to me now that's a bit arbitrary. But it doesn't care what the local ref is called, you can say what remote name you're pushing to directly, so:
git branch junkname origin/startingpoint
git push origin junkname:newbranch
git branch -d junkname
这篇关于如何在不创建本地分支的情况下创建远程Git分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文