git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* push.default and "git push"
@ 2022-11-28 21:32 Yuri Kanivetsky
  2022-11-29  1:28 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Yuri Kanivetsky @ 2022-11-28 21:32 UTC (permalink / raw)
  To: git

Hi,

I've been reading the documentation on git push lately, and there are
a couple of places I don't quite understand. From git-config:

> 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 maint and master there and no other branches, the repository you push to will have these two branches, and your local maint and master will be pushed there).

(1) What does "remember" exactly mean? Is this a round-about way to
say that when you push a branch it gets created? But no, it won't push
a branch, unless it exists remotely.

Actually I created a script to examine how these modes work:

https://gist.github.com/x-yuri/20f24f628db1bcbf272c055b33c18889

And from 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.

I've found that if there's no remote named "origin" it pushes to the
first remote. Or so it seems:

https://gist.github.com/x-yuri/888261d182fdab92040760138ea10a22

(2) I wonder if the documentation should be amended...

Regards,
Yuri

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: push.default and "git push"
  2022-11-28 21:32 push.default and "git push" Yuri Kanivetsky
@ 2022-11-29  1:28 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-11-29  1:28 UTC (permalink / raw)
  To: Yuri Kanivetsky; +Cc: git

Yuri Kanivetsky <yuri.kanivetsky@gmail.com> writes:

> (1) What does "remember" exactly mean?

Because your matching push updates only the branches that exist at
the receiving repository, you do not have to remember in your head
which branches you want to keep updating over there and write them
on your command line (i.e. "git push there this-branch" to update
"this-branch" in "there" repository).

You do not have to ask your configuration file to remember
(i.e. [remote "there"] push = refs/heads/this-branch), either.

Without having to make an active effort to "remember" on your side,
"git push there" would notice that they have this-branch (because
you pushed there the last time to create it) and you have updated
this-branch on your end, and update that branch.

That is what the verb "remember" refers to in that sentence.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-29  1:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 21:32 push.default and "git push" Yuri Kanivetsky
2022-11-29  1:28 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).