git/list[1] front-page[2] threads[3] people[4] search[5] about
 

push.default and "git push"

From
Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
Date
Nov 28, 2022, 21:32 UTC
Message-ID
<CAMhVC3ZHsGJs8XJPZOPYCWBCHJOkp8xnau=5xH_Bj33JUZ4DNA@mail.gmail.com>
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

Next: Junio C Hamano
Message 1 of 3 in “push.default and "git push"”
  1. Yuri KanivetskyNov 28, 2022
  2. Junio C HamanoNov 29, 2022
  3. Yuri KanivetskyDec 13, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.