Git推动上游到原点而不创建本地分支 [英] Git push upstream to origin without creating local branch
问题描述
我想与上游同步起源。通常我会执行以下步骤:
git fetch upsteam
git checkout< branchname>
git merge< branchname> <上游/ BRANCHNAME>
git push< branchname>
结帐创建了本地分行,我根本没有计划开展工作。我想避免这种情况,因此想知道我是否可以将更改从上游直接推送到原点。 你不需要合并(因为原点不会独立改变,你可以使用下面的代码)。
$ g $ f $ g $ $ $ $ $ $ $ b git push origin refs / remotes / uptstream / branchname:branchname
如果您需要合并,您将不会能够避免一些本地交互。
如果只有本地分支困扰您,您可以使用分离头进行尝试。
I want to sync up my origin with the upstream. Normally I do the following steps,
git fetch upsteam
git checkout <branchname>
git merge <branchname> <upstream/branchname>
git push <branchname>
The checkout creates local branches which I have no plans to work on at all. I would like to avoid that and therefore want to know if I can push the changes from upstream directly to origin somehow.
If you don't need the merge (because origin will not change independently you can use the following.
git fetch upstream
git push origin refs/remotes/uptstream/branchname:branchname
If you need to merge you will not be able to avoid some local interaction.
If it's only the local branch that bothers you, you could try it with a detached head.
这篇关于Git推动上游到原点而不创建本地分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!