0 votes
1 view
in Devops and Agile by (28.1k points)

I've been using Git for a while now and have recently downloaded an update only to find this warning message come up when I try to push.

warning: push.default is unset; its implicit value is 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

I can obviously set it to one of the values mentioned, but what do they mean? What's the difference between simple and matching?

If I change it on one client will I need to do anything on other clients that I share repos with?

1 Answer

0 votes
by (48k points)

Refer: https://git-scm.com/docs/git-config.html#git-config-pushdefault

It mentions that 

simple - in the centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one

matching - push all branches having the same name on both ends. This makes the repository you are pushing to remember the set of branches that will be pushed out (e.g. if you always push main and master there and no other branches, the repository you push to, will have these two branches, and your local main and master will be pushed there).

For effective working, you have to make sure all the branches you would push out are ready to be pushed out before running git push, as the whole point of this mode is to allow you to push all of the branches in one go. If you usually finish work on only one branch and push out the result, while other branches are unfinished, this mode is not for you. Also, this mode is not suitable for pushing into a shared central repository, as other people may add new branches there, or update the tip of existing branches outside your control.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...