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

Re: [RFC PATCH v2 2/2] push: support pushing to a remote group

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2026, 20:57 UTC
Message-ID
<xmqqpl50q2ib.fsf@gitster.g>
In-Reply-To
<20260318204028.1010487-3-usmanakinyemi202@gmail.com>
Usman Akinyemi <usmanakinyemi202@gmail.com> writes:
Show 5 quoted lines
> A known interaction: push.default = simple will die when the current
> branch has no upstream configured, because setup_default_push_refspecs()
> requires an upstream for that mode. Users pushing to a group should set
> push.default = current or supply explicit refspecs. This is consistent
> with how fetch handles default refspec resolution per remote.

Even if you are not pushing to a group but to a single remote, default=simple would die when the current branch has no upstream configured, so I do not know what the point of singling "default=simple" out is in the above paragraph. For that matter, is "default=current" so special and would it be the only way, other than giving an explicit refspec, to make the push succeed? Wouldn't default=matching, for example, work equally well?

Show 15 quoted lines
> +When a group name is given as the `<repository>` argument, the push is
> +performed to each member remote in turn.  The defining principle is:
> +
> +	git push <options> all-remotes <args>
> +
> +is exactly equivalent to:
> +
> +	git push <options> r1 <args>
> +	git push <options> r2 <args>
> +	...
> +	git push <options> rN <args>
> +
> +where r1, r2, ..., rN are the members of `all-remotes`.  No special
> +behaviour is added or removed — the group is purely a shorthand for
> +running the same push command against each member remote individually.

One thing this does not make it clear is if we abort upon the first failure, or even after some fail we still attempt to push to the rest of the remotes in the group.

> +Similarly, if `--force-with-lease` is given without an explicit expected
> +commit, Git will guess the expected commit for each remote independently
> +from that remote's own remote-tracking branch, the same way it would if
> +each push were run separately.

Understandable (even though it would be obvious from the "exactly equivalent to" above).

Show 6 quoted lines
> If an explicit commit is given with
> +`--force-with-lease=<refname>:<expect>`, that same value is forwarded
> +to every member remote, as if each of
> +`git push --force-with-lease=<refname>:<expect> r1`,
> +`git push --force-with-lease=<refname>:<expect> r2`, ...,
> +`git push --force-with-lease=<refname>:<expect> rN` had been invoked.
Understandable (ditto).
Show 12 quoted lines
> diff --git a/builtin/push.c b/builtin/push.c
> index 5b6cebbb85..33de769a33 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -542,7 +542,6 @@ static int git_push_config(const char *k, const char *v,
>  
>  	return git_default_config(k, v, ctx, NULL);
>  }
> -
>  int cmd_push(int argc,
>  	     const char **argv,
>  	     const char *prefix,
You didn't want to include this hunk, I presume?
Thanks.
Previous: Usman AkinyemiNext: Junio C Hamano
Message 12 of 39 in “push: add support for pushing to remote groups”
  1. 0/2 push: add support for pushing to remote groupsUsman Akinyemi, Mar 5, 2026
  2. 1/2 remote: move remote group resolution to remote.cUsman Akinyemi, Mar 5, 2026
  3. Junio C HamanoMar 6, 2026
  4. Usman AkinyemiMar 9, 2026
  5. 2/2 push: support pushing to a remote groupUsman Akinyemi, Mar 5, 2026
  6. Junio C HamanoMar 7, 2026
  7. Usman AkinyemiMar 9, 2026
  8. Junio C HamanoMar 9, 2026
  9. 0/2 push: add support for pushing to remote groupsUsman Akinyemi, Mar 18, 2026
  10. 1/2 remote: move remote group resolution to remote.cUsman Akinyemi, Mar 18, 2026
  11. 2/2 push: support pushing to a remote groupUsman Akinyemi, Mar 18, 2026
  12. Junio C HamanoMar 18, 2026
  13. Junio C HamanoMar 18, 2026
  14. Junio C HamanoMar 18, 2026
  15. Junio C HamanoMar 19, 2026
  16. Usman AkinyemiMar 25, 2026
  17. Junio C HamanoMar 18, 2026
  18. Usman AkinyemiMar 18, 2026
  19. 0/2 push: add support for pushing to remote groupsUsman Akinyemi, Mar 25, 2026
  20. 1/2 remote: move remote group resolution to remote.cUsman Akinyemi, Mar 25, 2026
  21. 2/2 push: support pushing to a remote groupUsman Akinyemi, Mar 25, 2026
  22. Junio C HamanoMar 25, 2026
  23. Usman AkinyemiMar 31, 2026
  24. Usman AkinyemiMar 31, 2026
  25. Junio C HamanoApr 1, 2026
  26. Junio C HamanoMar 27, 2026
  27. 0/2 push: add support for pushing to remote groupsUsman Akinyemi, Apr 27, 2026
  28. 1/2 remote: move remote group resolution to remote.cUsman Akinyemi, Apr 27, 2026
  29. 2/2 push: support pushing to a remote groupUsman Akinyemi, Apr 27, 2026
  30. Junio C HamanoApr 28, 2026
  31. 0/3 push: add support for pushing to remote groupsUsman Akinyemi, May 3, 2026
  32. 1/3 remote: fix sign-compare warnings in push_cas_optionUsman Akinyemi, May 3, 2026
  33. 2/3 remote: move remote group resolution to remote.cUsman Akinyemi, May 3, 2026
  34. 3/3 push: support pushing to a remote groupUsman Akinyemi, May 3, 2026
  35. Kristoffer HaugsbakkMay 12, 2026
  36. 0/3 push: add support for pushing to remote groupsUsman Akinyemi, May 18, 2026
  37. 1/3 remote: fix sign-compare warnings in push_cas_optionUsman Akinyemi, May 18, 2026
  38. 2/3 remote: move remote group resolution to remote.cUsman Akinyemi, May 18, 2026
  39. 3/3 push: support pushing to a remote groupUsman Akinyemi, May 18, 2026

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.