git push到特定分支 [英] git push to specific branch
问题描述
即使阅读了以下问题: git-push-current-branch ,我仍然在弄清楚如何编写git push命令时遇到困难.如问题链接中所述,从文档中尚不清楚.
Even after reading this question: git-push-current-branch, I am still having difficulty figuring out how I should write my git push command. As mentioned in the question link, it's not clear from the documentation.
我想使用我的现实世界"示例.以下是我在分支的顶层执行git status
命令时看到的内容:
I would like to use my 'real world' example. Following is what I see when I do a git status
command on the top level of my branch:
在分支amd_qlp_tester上
On branch amd_qlp_tester
您的分支比'origin/amd_qlp_tester'提前5次提交.
Your branch is ahead of 'origin/amd_qlp_tester' by 5 commits.
等...
所以我的分支名称是amd_qlp_tester
,但是它是从主分支分支"的(如果我的术语有误,那是因为我的SVN背景).但是还有一个名字`origin/amd_qlp_testser'
So my branch name is amd_qlp_tester
but it was "branched" off from the main branch (if I have the terms wrong it's because of my SVN background). But then there is also the name `origin/amd_qlp_testser'
那我该如何表达我的推送命令?
So how do I phrase my push command?
是否为以下任何一项?
git push origin/amd_qlp_tester
git push origin amd_qlp_tester
git push amd_qlp_tester
git push origin
git push
推荐答案
git push origin amd_qlp_tester
将为您工作.如果仅键入git push
,则当前分支的远程目录是默认值.
git push origin amd_qlp_tester
will work for you. If you just type git push
, then the remote of the current branch is the default value.
push的语法如下所示-git push <remote> <branch>
.如果您查看.git/config
文件中的远程文件,您将看到一个[remote "origin"]
条目,该条目指定存储库的url.因此,在命令的第一部分中,您将告诉Git在哪里可以找到该项目的存储库,然后只需指定一个分支即可.
Syntax of push looks like this - git push <remote> <branch>
. If you look at your remote in .git/config
file, you will see an entry [remote "origin"]
which specifies url of the repository. So, in the first part of command you will tell Git where to find repository for this project, and then you just specify a branch.
这篇关于git push到特定分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!