Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What's the difference between git push origin and git push-u origin master?

Shulou Source: shulou.com Published: 2022-06-02 07:23:33 10月03日 Update

This article introduces the relevant knowledge of "what is the difference between git push origin and git push-u origin master". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Git push origin

Git push origin

The above command indicates that the current branch is pushed to the corresponding branch of the origin host. If the current branch has only one tracking branch, the hostname can be omitted.

Note: origin is a remote warehouse alias, which is done by configuring a remote warehouse

Git remote add origin http://xxxx@git.XXXX.com/scm/wbqa/xxxx.git# origin is the remote warehouse alias followed by http for the remote warehouse address

II. Git push

Git push

If the current branch has a tracking relationship with multiple hosts, the-u option specifies a default host at this time, so that git push can be used later without any parameters.

3. Git push-u origin master

Git push-u origin master

The above command pushes the local master branch to the origin host, and specifies origin as the default host, and then you can use git push without any parameters. Git push without any parameters only pushes the current branch by default, which is called simple mode. In addition, there is an matching method that pushes all local branches that have corresponding remote branches. Before Git 2.0, the matching method was used by default, but now it is changed to simple by default.

4. Upload the local master to the remote warehouse branch

Git push: git push origin master:djs# origin is the set remote repository alias, master is the local branch name, and djs is the remote branch name "what's the difference between git push origin and git push-u origin master". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Branches hosts warehouses aliases parameters methods contents commands more knowledge push practical successful learning and then only at the same time name capital dilemma address multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei Microsoft Shulou Information MariaDB