简体   繁体   English

如何推送到 Gitlab 上的远程 git 分支?

[英]How to push to a remote git branch on Gitlab?

I have this repo on GiLab:我在 GiLab 上有这个 repo:

https://gitlab.com/testrepo/api.git

There's a branch on this repo called testing .这个 repo 上有一个名为testing的分支。 How can I push to the testing branch of this repo ?我怎样才能推送到这个 repo 的testing分支?

If I do:如果我这样做:

git push origin master

It'd push my master to probably the master of the repo.它会将我的主人推向可能是 repo 的主人。

You can use the command:您可以使用以下命令:

git push origin <your_local_branch>:<remote_branch>

to push on any branch in git.在 git 中推动任何分支。 In your example, this would be equivalent to running:在您的示例中,这相当于运行:

git push origin master:testing

You can also try this if you push on any branch in git如果您在 git 中推送任何分支,您也可以尝试此操作

If nothing works out go from the basic, create a new branch and go to that branch by git checkout branch_name and make the required changes in the code, than add ., commit and for pushing the local changes to git branch use below command.如果没有任何效果,请从基本开始,创建一个新分支并通过 git checkout branch_name 转到该分支,并在代码中进行所需的更改,然后添加 ., commit 并将本地更改推送到 git branch 使用下面的命令。 It should work.它应该工作。

$ git push --set-upstream origin Name_of_the_branch $ git push --set-upstream origin Name_of_the_branch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM