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

Re: Separate default remotes for pulling and pushing

From
DLDavid Lee <davidomundo@gmail.com>
Date
May 9, 2011, 08:34 UTC
Message-ID
<D0FA0C3F-8DA8-4607-A0A6-F9AFAB3EC3CE@gmail.com>
In-Reply-To
<20110509081708.GA5871@sigill.intra.peff.net>
Hey Jeff,
Thanks for the super write-up.
Show 13 quoted lines
> That probably doesn't quite do what David wants. It's useful when the
> URL for pushing and pulling a particular repository are different.
> 
> But if I understand it correctly, David has two _separate_ repositories.
> And using remote.*.pushurl for that has some unwanted side effects,
> because the tracking ref namespace (i.e., "remotes/origin/*") is shared
> by both, even though their refs may not be at the same position.
> 
> For example, when pushing "refs/heads/master" to the remote, git will
> update "refs/remotes/origin/master" to the pushed value. But that ref is
> supposed to reflect the value of the last fetch from his "original"
> repository, and now it doesn't. The ref value will flip back and forth
> between what's in the two repositories as he pushes and fetches.
I was actually using Sverre's recommendation with virtually no problems except for what you mention: the ref value flips back and forth.
Show 5 quoted lines
>  4. Decentralized, you're a developer that publishes work via git. You
>     call the upstream maintainer "origin", so fetches are convenient
>     (and git does this for you at clone, after all). But pushing, even
>     though you probably always push to the same central, does not have
>     a convenient shorthand.
By "push to the same central", I assume you mean "push to the same mirror of origin".
Show 11 quoted lines
> 
>     This is David's case (and mine, and I suspect some other git
>     developers who do enough work that they want to make it publicly
>     available via git, or even just have backups). It's also encouraged
>     by sites like github, where you might clone the upstream's
>     repository, but then pushes your changes up to a personal "fork"
>     to let others see and merge them.
> 
> So I think part of the reason we don't have such an option is that cases
> 1-3 are so common. But it would be a nice convenience for people in case
> 4.
I think github is making option 4 the dominant use case. In fact, in our workplace we have a similar workflow set up, where we pull from a central origin, but push to individual mirrors from where commits are reviewed, tested, and merged unto origin.
--David
Previous: Jeff KingNext: Jeff King
Message 4 of 14 in “Separate default remotes for pulling and pushing”
  1. David LeeMay 7, 2011
  2. Sverre RabbelierMay 7, 2011
  3. Jeff KingMay 9, 2011
  4. David LeeMay 9, 2011
  5. Jeff KingMay 9, 2011
  6. David LeeMay 9, 2011
  7. Jeff KingMay 9, 2011
  8. Junio C HamanoMay 9, 2011
  9. Jeff KingMay 9, 2011
  10. Junio C HamanoMay 9, 2011
  11. Jeff KingMay 10, 2011
  12. Jay SoffianMay 10, 2011
  13. Jeff KingMay 10, 2011
  14. Jay SoffianMay 10, 2011

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.