]> git.ipfire.org Git - thirdparty/git.git/commit
remote: find tracking branches for URL push destinations
authorHarald Nordgren <haraldnordgren@gmail.com>
Wed, 22 Jul 2026 18:08:58 +0000 (18:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Jul 2026 18:29:49 +0000 (11:29 -0700)
commit93775e35b7ed7983a8aaa33a566f45a8a1152718
tree12f8c504065bf5bc2ac3f8c331f9c2ded091aa3f
parent8391f01768864373d27cf7b1267ea69d54675cf6
remote: find tracking branches for URL push destinations

Git accepts a repository URL as branch.<name>.pushRemote and can push
to it. This branch setting takes precedence over remote.pushDefault.

A branch can be configured with a URL-valued pushRemote before any push
occurs. If the remotes are later rearranged with "git remote rename" and
"git remote add", the newly added remote may use that URL. The URL value
is unaffected by the rename and continues to take precedence over
remote.pushDefault. The URL and the remote then point to the same
repository, but Git does not connect them for tracking. Pushing works,
but @{push} cannot identify the remote's tracking branch. As a result,
"git status" cannot show the push branch, and an up-to-date push can
leave its tracking information stale.

When exactly one configured remote would push to the same URL, use that
remote for push tracking. Continue to push to the URL so the configured
remote's push settings do not change existing behavior. Keep the current
behavior when no remote matches or multiple remotes match.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/branch.adoc
Documentation/revisions.adoc
remote.c
remote.h
t/t5505-remote.sh
transport.c