Nachfolgende Meldung bekam ich letztes angezeigt, als ich mit git gearbeitet habe. Doch was hat es damit genau auf sich, was ist der Unterschied zwischen “matching” und “simple”?

1
2
3
4
5
6
7
8
9
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

In der Dokumentation von git steht Folgendes geschrieben (Auszug):

  • matching - push all branches having the same name in both ends. This is for those who prepare all the branches into a publishable shape and then push them out with a single command. It is not appropriate for pushing into a repository shared by multiple users, since locally stalled branches will attempt a non-fast forward push if other users updated the branch. + This is currently the default, but Git 2.0 will change the default to simple.
  • simple - like upstream, but refuses to push if the upstream branch’s name is different from the local one. This is the safest option and is well-suited for beginners. It will become the default in Git 2.0.
  • upstream - push the current branch to its upstream branch (tracking is a deprecated synonym for this). With this, git push will update the same remote ref as the one which is merged by git pull, making push and pull symmetrical. See branch.<name>.merge for how to configure the upstream branch.

Zusammengefasst pushed “matching” alle lokalen Branches auf die jeweiligen gleichnamigen Branches auf dem Remote. “Simple” pushed ausschließlich den aktuellen Branch auf den Branch, der mit git pull abgerufen wird, überprüft aber zuvor die Namen der beiden Branches und schlägt fehl, sollten diese nicht übereinstimmen.

Dieses Verhalten wird nur dann verwendet, wenn im Befehl kein Branch genannt wird, der gepushed werden soll.