git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
To: git@vger.kernel.org
Subject: push.default and "git push"
Date: Mon, 28 Nov 2022 23:32:04 +0200	[thread overview]
Message-ID: <CAMhVC3ZHsGJs8XJPZOPYCWBCHJOkp8xnau=5xH_Bj33JUZ4DNA@mail.gmail.com> (raw)

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

             reply	other threads:[~2022-11-28 21:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 21:32 Yuri Kanivetsky [this message]
2022-11-29  1:28 ` push.default and "git push" Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMhVC3ZHsGJs8XJPZOPYCWBCHJOkp8xnau=5xH_Bj33JUZ4DNA@mail.gmail.com' \
    --to=yuri.kanivetsky@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).