Search code examples
gitgitlabgit-push

How to push to a remote git branch on Gitlab?


I have this repo on GiLab:

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

There's a branch on this repo called testing. How can I push to the testing branch of this repo ?

If I do:

git push origin master

It'd push my master to probably the master of the repo.


Solution

  • You can use the command:

    git push origin <your_local_branch>:<remote_branch>
    

    to push on any branch in git. In your example, this would be equivalent to running:

    git push origin master:testing