Push branch to remote
suggest changeUse to push commits made on your local branch to a remote repository.
The git push
command takes two arguments:
- A remote name, for example,
origin
- A branch name, for example,
master
For example:
git push <REMOTENAME> <BRANCHNAME>
As an example, you usually run git push origin master
to push your local changes to your online repository.
Using -u
(short for --set-upstream
) will set up the tracking information during the push.
git push -u <REMOTENAME> <BRANCHNAME>
By default, git
pushes the local branch to a remote branch with the same name. For example, if you have a local called new-feature
, if you push the local branch it will create a remote branch new-feature
as well. If you want to use a different name for the remote branch, append the remote name after the local branch name, separated by :
:
git push <REMOTENAME> <LOCALBRANCHNAME>:<REMOTEBRANCHNAME>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents