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

Re: [RFC/PATCH] push: introduce implicit push

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2013, 22:28 UTC
Message-ID
<7v38uvcrjl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1365780835-2853-1-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 11 quoted lines
> Currently, there is no way to invoke 'git push' without explicitly
> specifying the destination to push to as the first argument.  When
> pushing several branches, this information is often available in
> branch.<name>.pushremote, falling back to branch.<name>.remote.  So,
> we can use this information to create a more pleasant push experience.
> You can now do:
>
>     $ git push master next pu
>
> If the branches master, next, and pu have different remotes, do_push()
> will be executed three times on the three different remotes.

I am lukewarm on this one, slightly more close to negative than positive, for a couple of reasons.

The primary reason is the confusion factor Jeff mentioned in the thread that inspired this patch. People would realize it is very natural to decide where to push to based on what branch is being pushed, but only after they think it long and hard enough [*1*]. I suspect that it is an equally natural expectation for casual users that the destination is chosen based on the current branch, if only because that is what they are used to seeing when they say "git push" without any argument.

Even though I personally am in favor of this "destination is tied to what is pushed out", not "destination is chosen based on the current branch", I can understand why some people would prefer the latter, and why they find it simpler and easier to explain.

The second reason is purely on the differences between what the above clean-nice explanation says and what the patch actually does.

I think "is-possible-refspec" and "pushremote-get-for-refspec" are both way over-engineered, even for people who agree with me and the above introduction for this change to favor "destination depends on what branch is pushed out". If is-possible-refspec is replaced with a much simpler to understand logic, "Is this a local branch name?", possibly combined with "There is no such path on the filesystem" and "It's not a defined remote" (iow, reject "git push master:next" and anything more complex) [*2*], I suspect it would be a bit more sellable.

[Footnote]

*1* I've explained in a separate message why basing the destination on what is being pushed is logical and internally consistent.

*2* This is in the same spirit (not implementation or design) as revname vs pathspec disambiguation.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 2 of 21 in “push: introduce implicit push”
  1. push: introduce implicit pushRamkumar Ramachandra, Apr 12, 2013
  2. Junio C HamanoApr 12, 2013
  3. Ramkumar RamachandraApr 13, 2013
  4. Junio C HamanoApr 14, 2013
  5. Jakub NarębskiApr 14, 2013
  6. Ramkumar RamachandraApr 14, 2013
  7. Junio C HamanoApr 15, 2013
  8. Johannes SixtApr 15, 2013
  9. Junio C HamanoApr 15, 2013
  10. John KeepingApr 15, 2013
  11. Ramkumar RamachandraApr 15, 2013
  12. John KeepingApr 15, 2013
  13. Junio C HamanoApr 15, 2013
  14. Ramkumar RamachandraApr 15, 2013
  15. John KeepingApr 15, 2013
  16. Felipe ContrerasApr 15, 2013
  17. John KeepingApr 15, 2013
  18. Felipe ContrerasApr 15, 2013
  19. Ramkumar RamachandraApr 15, 2013
  20. Jonathan NiederApr 16, 2013
  21. Jonathan NiederApr 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.