Use to push commits made on your local branch to a remote repository.
The git push
command takes two arguments:
origin
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>