Git Push Questions - Pedantic

My project has a master branch and a searchfeature branch. I moved the searchfeature branch to the remote repository, everything is fine so far

When I worked on this thread this morning, I did "git push", I got the following:

warning: You did not specify any refspecs to push, and the current remote warning: has not configured any push refspecs. The default action in this warning: case is to push all matching refspecs, that is, all branches warning: that exist both locally and remotely will be updated. This may warning: not necessarily be what you want to happen. warning: warning: You can specify what action you want to take in this case, and warning: avoid seeing this message again, by configuring 'push.default' to: warning: 'nothing' : Do not push anything warning: 'matching' : Push all matching branches (default) warning: 'tracking' : Push the current branch to whatever it is tracking warning: 'current' : Push the current branch 

So, I went ahead by doing git config push.default tracking and voila, git push works, this is not a problem, no warnings.

What I do not understand, what is the difference between "current" and "tracking", if you do not do "tracking at all costs", then what is the meaning of the "current" - where would it go? What scenarios would you use instead of tracking?

Also, what scenarios will ever use "nothing"?

+4
source share
1 answer

Since Git1.6.3 :

When the user does not tell " git push " what to press, he always pushes the corresponding links.
For some people, this is unexpected, and a new push.default configuration variable has been introduced that allows you to change other default behavior.
To advertise a new feature, a big warning appears if it is not configured and try git push with no arguments.

So the difference between current and tracking is as follows:

  • current will accept the appropriate ref (a remote branch with the same name that might be missing)
  • tracking will be based on a remote link for use in tracking links associated with this local branch. If he does not track anything, he will not push. But it can track the remote branch with a different name .a remo

Note. default nothing will be useful for a read-only repository made only for content advice, where no work should be done and published anywhere.

See also git current branch . Question SO.


March 2012 Update: Beware: The default mapping policy may change soon :

See " Please discuss: what should git push do when you don't say what to push? "

In the current setting (i.e. push.default=matching ), git push without an argument will delete all branches that exist locally and remotely with the same name .
This is usually suitable when a developer pushes his own public repository, but can be confusing if not dangerous when using shared storage.

Suggestion to change the default value to " upstream " , that is, push only the current branch and push the git pull pull from branch.
Another candidate: current '; this pushes only the current branch to the remote branch with the same name.

What has been discussed so far can be seen in this thread:

http://thread.gmane.org/gmane.comp.version-control.git/192547/focus=192694

Previous relevant discussions include:

To join the discussion, send your messages to: git @ vger.kernel.org

+6
source

Source: https://habr.com/ru/post/1301793/


All Articles