问题描述
即使阅读了这个问题: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 run the git status
command on the top level of my 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
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 ;
.如果您查看 .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 到指定的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!