git push -u origin master and git push <remote host name> <local branch name>: <remote branch name> action

git push

git pushCommand is used to update the local branch, pushed to the remote host. Its format git pullcommand similar.


$ git push <远程主机名> <本地分支名>:<远程分支名>

Note: here: before and after must be no spaces.

Note that the order of the branch push wording is <Origin>: <dest>, it git pullis <remote branch>: <local branch>, and git pushthe <local branch>: <remote branch>.

If you omit the remote branch name, it said it would push the local branch with the presence of "trace relationship" remote branch (usually both of the same name), if the remote branch does not exist, it will be new.


$ git push origin master

Represents the above command, the local masterbranch pushed originhost masterbranch. If the latter does not exist, it is new.

If you omit the local branch name, then delete the specified remote branch, because this is equivalent to pushing an empty local branches to remote branches.


$ git push origin :master
# 等同于
$ git push origin --delete master

The above command means to delete originthe host masterbranch.

If there is tracing the relationship between branch and remote branch currently, the local branch and a remote branch can be omitted.


$ git push origin

Represents the above command, the current will push the branch origincorresponding to the branch host.

If the current track has only one branch branch, then the host name can be omitted.


$ git push

If the current relationship between the presence of trace branches and multiple hosts, you can use the -uoption to specify a default host so that you can later use without any parameters git push.


$ git push -u origin master

The above command will local masterbranch pushed to originthe host, while designated originas a default host, the latter can be used without any use git pushof.

Guess you like

Origin www.cnblogs.com/cuiqq/p/11101048.html