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

Re: [PATCH v3 0/2] remote: url-based pushRemote with renamed remotes

From
Ben Knoble <ben.knoble@gmail.com>
Date
Jul 22, 2026, 10:35 UTC
Message-ID
<3FE12592-B663-438C-B33E-A251AE08E146@gmail.com>
In-Reply-To
<pull.2358.v3.git.git.1784664859.gitgitgadget@gmail.com>
Show 81 quoted lines
> Le 21 juil. 2026 à 16:14, Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com> a écrit :
> 
> Fix git status not showing the push branch after remotes are renamed, when
> branch.<name>.pushRemote is a URL matching exactly one configured remote.
> 
> Changes in v4:
> 
> * Match against the actual push URL, including pushurl and pushInsteadOf.
> * Clarify how rearranging remotes exposes the git status tracking problem.
> * Simplify and correct the documentation for URL-valued pushRemote.
> 
> Changes in v3:
> 
> * Revamp commit messages to clarify motivation.
> 
> Changes in v2:
> 
> * Clarify that URL push destinations already work and that this change only
>   restores their tracking information.
> * Document URL values for branch.<name>.pushRemote and their @{push}
>   behavior.
> 
> Harald Nordgren (2):
>  remote: pass repository to push tracking helper
>  remote: find tracking branches for URL push destinations
> 
> Documentation/config/branch.adoc |   1 +
> Documentation/revisions.adoc     |   3 +
> remote.c                         |  43 +++++++++--
> remote.h                         |   2 +
> t/t5505-remote.sh                | 124 +++++++++++++++++++++++++++++++
> transport.c                      |   5 +-
> 6 files changed, 172 insertions(+), 6 deletions(-)
> 
> 
> base-commit: 48bbf81c29ca9a4479ec7850fe206518682cdb2f
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2358%2FHaraldNordgren%2Fremote-resolve-url-push-tracking-v3
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2358/HaraldNordgren/remote-resolve-url-push-tracking-v3
> Pull-Request: https://github.com/git/git/pull/2358
> 
> Range-diff vs v2:
> 
> 1:  b1ac49de87 = 1:  b1ac49de87 remote: pass repository to push tracking helper
> 2:  6e924a7fec ! 2:  a343af9d50 remote: find tracking branches for URL push destinations
>     @@ Metadata
>       ## Commit message ##
>          remote: find tracking branches for URL push destinations
> 
>     -    Git already accepts a repository URL as branch.<name>.pushRemote and
>     -    can push to it. When a configured remote has the same URL, however,
>     -    "git status" cannot show that remote's push branch.
>     +    Git accepts a repository URL as branch.<name>.pushRemote and can push
>     +    to it. This branch setting takes precedence over remote.pushDefault.
> 
>     -    This can happen in fork workflows when the original remote is renamed
>     -    to "upstream", the fork is added as "origin", and an existing
>     -    pushRemote value still contains the fork URL. The URL still points to
>     -    the right repository, so pushing works. However, @{push} is unavailable
>     -    because Git does not connect the URL to "origin". As a result,
>     +    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 local tracking information stale.
>     +    leave its tracking information stale.
> 
>     -    When exactly one configured remote has the URL as one of its
>     -    remote.<name>.url values, use its fetch refspec to find and refresh the
>     -    push branch. Keep the URL as the push destination so the configured
>     -    remote's push settings do not change existing behavior. Keep the
>     -    current behavior when no remote matches or multiple remotes match.
>     +    When exactly one configured remote uses the push destination 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>
I find this explanation makes more sense ; it’s not how I use remote renames, since I don’t usually use URL-valued remotes, but I can see how things arise now. Thanks!
Previous: Junio C HamanoNext: Harald Nordgren via GitGitGadget
Message 18 of 23 in “remote: resolve url push tracking”
  1. 0/2 remote: resolve url push trackingHarald Nordgren via GitGitGadget, Jul 20, 2026
  2. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 20, 2026
  3. Junio C HamanoJul 20, 2026
  4. 2/2 remote: resolve URL-valued push tracking remotesHarald Nordgren via GitGitGadget, Jul 20, 2026
  5. Junio C HamanoJul 20, 2026
  6. Harald NordgrenJul 20, 2026
  7. Junio C HamanoJul 20, 2026
  8. Junio C HamanoJul 21, 2026
  9. 0/2 remote: renamed remote push trackingHarald Nordgren via GitGitGadget, Jul 21, 2026
  10. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 21, 2026
  11. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 21, 2026
  12. D. Ben KnobleJul 21, 2026
  13. Harald NordgrenJul 21, 2026
  14. 0/2 remote: url-based pushRemote with renamed remotesHarald Nordgren via GitGitGadget, Jul 21, 2026
  15. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 21, 2026
  16. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 21, 2026
  17. Junio C HamanoJul 21, 2026
  18. Ben KnobleJul 22, 2026
  19. 0/2 remote: url-based pushRemote with renamed remotesHarald Nordgren via GitGitGadget, Jul 22, 2026
  20. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 22, 2026
  21. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 22, 2026
  22. Junio C HamanoJul 22, 2026
  23. Junio C HamanoJul 23, 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.