Number945
Number945

Reputation: 4940

push.default will work only when no ref spec defined?

I have a simple query. Will push.default will work only when no ref spec defined ?

Upvotes: 0

Views: 31

Answers (1)

Mark Adelsberger
Mark Adelsberger

Reputation: 45669

From the git push documentation (https://git-scm.com/docs/git-push):

When the command line does not specify where to push with the <repository> argument, branch.*.remote configuration for the current branch is consulted to determine where to push. If the configuration is missing, it defaults to origin.

When the command line does not specify what to push with <refspec>... arguments or --all, --mirror, --tags options, the command finds the default <refspec> by consulting remote.*.push configuration, and if it is not found, honors push.default configuration to decide what to push (See git-config[1] for the meaning of push.default).

According to this, whether you specify a remote is handled independently from whether you specify a refspec, and the rules for when/how push.default is used are governed by the latter.

There are also plenty of examples on that page if clarification is needed, and if you know what behavior you're looking for it shouldn't be that hard to set up a test if still in doubt.

Upvotes: 1

Related Questions