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

Re: [ITCH] Specify refspec without remote

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2013, 22:14 UTC
Message-ID
<7v4nfbcs6h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130410185958.GA22394@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Which is still kind of weird, because why should the branch you are on
> affect the default push location? But that is how default "matching" has
> always behaved, and we would remain consistent with that.

I agree that what makes us behave "kind of weird" is that the current branch is used to look up branch.$name.{remote,pushremote} when pushing. I do not think "matching" [*1*] has anything to do with it.

The per-branch configuration, branch.$name.{remote,pushremote}, says "this branch interacts with a remote that is different from what I normally interact with".

It is excusable for branch.$name.remote to take the current branch into account, when it is used to govern the fetch-integrate side (i.e. not used as a fall-back for branch.$name.pushremote). In order to affect that configured local branch, e.g. "git pull" to merge other's work, you need to have that named branch checked out in your working tree. Triggering the effect of the configuration based on which branch is checked out makes more sense because of that reason when you are fetching.

It does not make much sense to use the current branch as the key to look it up when you are pushing things out. If anything, what is being pushed out should be what determines where it goes.

But that is a realization that comes after you think the issue long and hard enough. To a casual end user, I think it is an equally or even more natural expectation a "git push" would pick the destination based on what branch you are currently on, as that is what happens when he runs the command without any argument.

[Footnote]

*1* The "matching" semantics is to support the workflow for people who batch things up. You perfect _all_ your branches that matter to the public, and push all of them in one go. If you do not finish a work on one branch and push out when other branches are not yet ready, you do not want your push to be limited to the current branch. And you do not have to "configure" what branches should be visible to the public. Instead, you have _your_ remote remember it for you: what are already there are the ones that are updated.

The "current", "upstream", etc. are to support folks who want to push work done on a single branch out as soon as it is done, even though the other branches are in no shape to be pushed out.

Previous: Ramkumar RamachandraNext: Jeff King
Message 62 of 68 in “[ITCH] Specify refspec without remote”
  1. Ramkumar RamachandraMar 18, 2013
  2. Jeff KingMar 18, 2013
  3. Ramkumar RamachandraMar 19, 2013
  4. Jeff KingMar 19, 2013
  5. Duy NguyenMar 19, 2013
  6. Ramkumar RamachandraMar 19, 2013
  7. Duy NguyenMar 19, 2013
  8. Holger Hellmuth (IKS)Mar 19, 2013
  9. Holger Hellmuth (IKS)Mar 19, 2013
  10. Junio C HamanoMar 19, 2013
  11. Junio C HamanoMar 19, 2013
  12. Ramkumar RamachandraApr 9, 2013
  13. Junio C HamanoApr 9, 2013
  14. Ramkumar RamachandraApr 9, 2013
  15. Junio C HamanoApr 9, 2013
  16. Ramkumar RamachandraApr 9, 2013
  17. Ramkumar RamachandraApr 9, 2013
  18. Junio C HamanoApr 9, 2013
  19. Jonathan NiederApr 9, 2013
  20. Jonathan NiederApr 9, 2013
  21. Junio C HamanoApr 10, 2013
  22. Jeff KingApr 10, 2013
  23. Junio C HamanoApr 10, 2013
  24. Jeff KingApr 10, 2013
  25. Junio C HamanoApr 10, 2013
  26. Jeff KingApr 10, 2013
  27. Ramkumar RamachandraApr 10, 2013
  28. Ramkumar RamachandraApr 10, 2013
  29. Jeff KingApr 10, 2013
  30. Ramkumar RamachandraApr 10, 2013
  31. Jeff KingApr 10, 2013
  32. Ramkumar RamachandraApr 10, 2013
  33. Ramkumar RamachandraApr 10, 2013
  34. Ramkumar RamachandraApr 10, 2013
  35. Junio C HamanoApr 10, 2013
  36. Ramkumar RamachandraApr 10, 2013
  37. Jonathan NiederApr 10, 2013
  38. Jeff KingApr 10, 2013
  39. Jonathan NiederApr 10, 2013
  40. Jeff KingApr 10, 2013
  41. Ramkumar RamachandraApr 10, 2013
  42. Jeff KingApr 10, 2013
  43. Ramkumar RamachandraApr 10, 2013
  44. Jeff KingApr 10, 2013
  45. Ramkumar RamachandraApr 10, 2013
  46. Jonathan NiederApr 10, 2013
  47. Ramkumar RamachandraApr 10, 2013
  48. Jonathan NiederApr 10, 2013
  49. Ramkumar RamachandraApr 10, 2013
  50. Jeff KingApr 10, 2013
  51. Ramkumar RamachandraApr 10, 2013
  52. Jeff KingApr 10, 2013
  53. Ramkumar RamachandraApr 10, 2013
  54. Jeff KingApr 10, 2013
  55. Ramkumar RamachandraApr 10, 2013
  56. Ramkumar RamachandraApr 11, 2013
  57. Ramkumar RamachandraApr 11, 2013
  58. Junio C HamanoApr 11, 2013
  59. Ramkumar RamachandraApr 13, 2013
  60. Junio C HamanoApr 10, 2013
  61. Ramkumar RamachandraApr 10, 2013
  62. Junio C HamanoApr 12, 2013
  63. Jeff KingApr 10, 2013
  64. Ramkumar RamachandraApr 10, 2013
  65. Jeff KingApr 10, 2013
  66. Junio C HamanoApr 10, 2013
  67. Jeff KingApr 10, 2013
  68. Ramkumar RamachandraApr 10, 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.