When the newly installed Git is not fully configured, using GIT push will have the following message:
Warning:push.default is unset; Its implicit value was changing in Git 2.0 from ' matching ' to ' simple '. To squelch this message and maintain the current behavior after the default changes, use:
git config–global push.default Matching
To squelch this message and adopt the new behavior now, use:
Git config–global push.default Simple
When Push.default was set to ' matching ', git would push local branches to the remote branches that already exist with the SA Me name.
The reason for this is that git does not now know how many branches of code to commit, whether it is the current branch or all branches.
You can modify the Push.default property in the GIT configuration to determine the default submission method for Git push, which defaults to simple after Git 2.0, the default is the matching,2.0 version. It is because of this change that this prompt message appears.
We can use the following command to change the value of the Push.default:
$ git config--global push.default ' option '
' option ' is the value to set, Push.default has the following optional values:
Nothing , current, upstream, simple, matching
The meanings of each attribute are:
Nothing-the git push command is not valid without displaying the specified remote branch.
Current-Push the branch to the same name as the remote repository and automatically creates the branch if it does not exist in the remote repository.
upstream -Push the current branch to its upstream branch.
Simple-similar to the upstream property, but rejects the push operation if the local branch has a different name than the remote upstream branch.
matching -push local and remote branches with the same name exist. Upstream Branch
A upstream branch is mentioned above, which explains what it means:
Git has upstream and downstream, in short, when we push the code for a branch x in warehouse A to the warehouse B branch y, this branch of warehouse B is called the X branch of upstream, and X is called the downstream of Y, This is a relative relationship where each local branch can have a relatively remote upstream branch (note that the upstream branch can have a different name, but usually we will use a branch of the same name as the upstream).
The initial commit of a local branch, such as a GIT push origin develop operation, does not define the upstream branch of the current local branch, and we can push–set-upstream origin develop via Git, The more concise way to associate the upstream branch of the local develop branch is to include the-u parameter when initial push, such as GIT push-u origin develop, which specifies the upstream of the current branch at the same time as the push.
Note that Push.default = current can automatically create a branch with the same name if the remote branch of the same name does not exist, sometimes this is an extremely convenient mode, such as initial push you can enter git push directly without displaying the specified remote branch.