]> git.ipfire.org Git - thirdparty/git.git/commit
push: support pushing to a remote group
authorUsman Akinyemi <usmanakinyemi202@gmail.com>
Sun, 3 May 2026 15:34:02 +0000 (21:04 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 May 2026 01:11:17 +0000 (10:11 +0900)
commit8ea82816652d20ac7070a8fcd60980568a8a293c
treef4128180ecc3be52716d7593974189513ca785d3
parent3e7b9dce27b1519f6745c89fe01f0b840acddb0a
push: support pushing to a remote group

`git fetch` accepts a remote group name (configured via `remotes.<name>`
in config) and fetches from each member remote. `git push` has no
equivalent — it only accepts a single remote name.

Teach `git push` to resolve its repository argument through
`add_remote_or_group()`, which was made public in the previous patch,
so that a user can push to all remotes in a group with:

    git push <group>

When the argument resolves to a single remote, the behaviour is
identical to before. When it resolves to a group, each member remote
is pushed in sequence.

The group push path rebuilds the refspec list (`rs`) from scratch for
each member remote so that per-remote push mappings configured via
`remote.<name>.push` are resolved correctly against each specific
remote. Without this, refspec entries would accumulate across iterations
and each subsequent remote would receive a growing list of duplicated
entries.

Mirror detection (`remote->mirror`) is also evaluated per remote using
a copy of the flags, so that a mirror remote in the group cannot set
TRANSPORT_PUSH_FORCE on subsequent non-mirror remotes in the same group.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-push.adoc
builtin/push.c
t/meson.build
t/t5566-push-group.sh [new file with mode: 0755]