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

Re: man page for "git remote set-url" seems confusing/contradictory

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 16, 2018, 23:13 UTC
Message-ID
<xmqqefjewxr4.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CA+P7+xrDsPXA6Bq77gYwWtc16Dz4drg+CHA80=vBNB9-NhxHVg@mail.gmail.com>
Jacob Keller <jacob.keller@gmail.com> writes:
Show 6 quoted lines
> Things won't work so well if you set the push url and fetch url to
> different repositories. Git assumes that refs updated by "push" will
> also be reflected via "fetch".
>
> I don't know offhand what will break, but likely something will. For
> one, when you fetch again it will rewind your remotes after the push.

Exactly. I still haven't fully embraced it myself, but for a long time, "git push" pretends as if it fetched from that remote and updates the corresponding remote tracking branches (if you have any), so you'll be inviting inconsistent behaviour if you set your fetch and push URLs pointing at two logically separate places.

This is a tangent, but there probably should be a boolean that disables this feature in "git push" per destination repository, i.e. "when pushing into this repository, pretend that we immediately fetched from the refs we just pushed to and update the remote tracking branches we have for them: yes/no". It is not entirely implausible to envision an overly smart remote repository that turns a non-fast-forward push into an automatic rebase when it is safe to do so, instead of failing such a push, and you'd disable the "assume what we pushed would appear there" when talking to such a remote.

Previous: Jacob KellerNext: Jacob Keller
Message 5 of 12 in “man page for "git remote set-url" seems confusing/contradictory”
  1. Robert P. J. DayApr 16, 2018
  2. Andreas SchwabApr 16, 2018
  3. Robert P. J. DayApr 16, 2018
  4. Jacob KellerApr 16, 2018
  5. Junio C HamanoApr 16, 2018
  6. Jacob KellerApr 17, 2018
  7. Robert P. J. DayApr 17, 2018
  8. Jacob KellerApr 17, 2018
  9. Junio C HamanoApr 18, 2018
  10. Todd ZullingerApr 18, 2018
  11. Martin ÅgrenApr 19, 2018
  12. doc/clone: update caption for GIT URLS cross-referenceTodd Zullinger, Apr 19, 2018

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.