Skip to main content

Push branches

View your available remote repositories, i.e., remotes.

git remote -v

Push your branch to the remote.

git push ${REMOTE} ${LOCAL_BRANCH_NAME}

By default, Git will push your local branch to the remote branch matching its name. If one doesn't exist remotely, Git will create it.

However, if you wish to push to a specific remote branch, append a colon and the remote branch's name.

git push ${REMOTE} ${LOCAL_BRANCH_NAME}:${REMOTE_BRANCH_NAME}

References

  1. "Git Push to Remote Branch – How to Push a Local Branch to Origin" freeCodeCamp.