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

Re: [RFC/PATCH 3/3] push: add separate 'downstream' branch

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
May 16, 2013, 08:21 UTC
Message-ID
<CALkWK0nTS6Vh7GfnrLWAK5VeevQyGN5N7xT43c+uqBQ5oM5tww@mail.gmail.com>
In-Reply-To
<1368675828-27418-4-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras wrote:
Show 5 quoted lines
>   [branch "master"]
>           remote = origin
>           merge = refs/heads/master
>           pushremote = github
>           push = refs/heads/master
Hm.  Some thoughts:

fetch and push aren't symmetric. By default fetches are batched: when you say 'git fetch', it fetches all the refs and uses the remote.<name>.fetch refspec to update the refs on your side. Now, I would argue that this is the correct design, because I rarely want to fetch just one ref (and that is broken, by the way: refs on my side aren't updated for some weird reason). The other reason this is correct is because fetching has nothing to do with local branches: how you _merge_ your remote branches to your local branches is entirely orthogonal to the issue (and that is controlled by branch.<name>.merge).

Now, push is a different ball game altogether. There are people who do batched pushes (push.default = matching has been the default for 8 years now). However, the support for a batched push in a triangular workflow is very limited: I can't say git push master hot-branch pickaxe-doc, and expect them to go to the right remotes (this idea has already been discussed and rejected). Back to your patch: if you want to support batched pushes to map refs correctly, you should write a patch for remote.<name>.push. It has a very valid usecase too: there are people who use Gerrit and they shouldn't have to do git push <name>:refs/for/<name> every single time. Neither should they have to configure each branch.<name>.push. The ref-mapping is an inherent property of the remote, not of the local branch. And branch.<name>.merge is entirely orthogonal to ref-mapping, as I already explained.

That said, I think the concept of a downstream can be useful. I have branch.hot-branch.remote set to origin, and branch.hot-branch.pushremote set to ram. Now, I push some changes: my prompt still says > (indicating unpushed changes), and this is very annoying. I would definitely like git to be able to recognize that I'm ahead of upstream, but in-sync with my downstream. So, your branch.<name>.push should probably be named branch.<name>.downstreamref and be used only for informational purposes (@{d} and git status)? Wait, why do we need it at all? Is there something that we cannot infer from a proposed remote.<name>.push? Why will we ever need to override that refspec mapping with a local branch configuration?

Previous: Junio C HamanoNext: Felipe Contreras
Message 19 of 28 in “New kind of upstream branch: downstream branch”
  1. 0/3 New kind of upstream branch: downstream branchFelipe Contreras, May 16, 2013
  2. 1/3 remote: don't override default if cur head remote is '.'Felipe Contreras, May 16, 2013
  3. 2/3 pull: trivial cleanupsFelipe Contreras, May 16, 2013
  4. Ramkumar RamachandraMay 16, 2013
  5. Felipe ContrerasMay 16, 2013
  6. Ramkumar RamachandraMay 16, 2013
  7. Felipe ContrerasMay 16, 2013
  8. Ramkumar RamachandraMay 16, 2013
  9. Felipe ContrerasMay 16, 2013
  10. Ramkumar RamachandraMay 16, 2013
  11. Felipe ContrerasMay 16, 2013
  12. Antoine PelisseMay 16, 2013
  13. Felipe ContrerasMay 16, 2013
  14. 3/3 push: add separate 'downstream' branchFelipe Contreras, May 16, 2013
  15. Junio C HamanoMay 16, 2013
  16. Felipe ContrerasMay 16, 2013
  17. Junio C HamanoMay 16, 2013
  18. Junio C HamanoMay 16, 2013
  19. Ramkumar RamachandraMay 16, 2013
  20. Felipe ContrerasMay 16, 2013
  21. Ramkumar RamachandraMay 16, 2013
  22. Felipe ContrerasMay 16, 2013
  23. Ramkumar RamachandraMay 16, 2013
  24. Felipe ContrerasMay 16, 2013
  25. Ramkumar RamachandraMay 16, 2013
  26. Felipe ContrerasMay 16, 2013
  27. Ramkumar RamachandraMay 16, 2013
  28. Felipe ContrerasMay 16, 2013

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.