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

Re: git push

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2009, 07:01 UTC
Message-ID
<7vskm3c84t.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<43d8ce650902242238s7ab4c851p9c820c96b67aa62b@mail.gmail.com>
John Tapsell <johnflux@gmail.com> writes:
>   Following the idea of 'least damage', what do people think of making
> "git push" only push the branch you are currently on?

Having an easy way to ask to push only one branch (typically the currently checked-out one) is a good thing. You can obviously say "git push origin master" (or whatever branch you are on). We also added "git push origin HEAD". I thought we even added "git push HEAD" or "git push --current", but I may be mistaken.

But if you are talking about changing the default when "git push" is run without any parameter, I have to say it is a terrible idea, for two reasons, and one is too obvious to state so I wouldn't repeat it and talk only about the other one.

I've noticed that people who ask for such a default tend to push too often and worse they tend to push before they have their act together. Surely their other branches may not be ready, but it is likely their current branch isn't either ;-)

If you shoot for the least damage for such people, the sanest default for "git push" would be to do nothing. You *always* say what to push where, then there is no risk of pushing something you did not intend to. Perhaps "push.default = never" configuration may not be such a bad idea?

Previous: Jeff KingNext: John Tapsell
Message 3 of 17 in “git push”
  1. John TapsellFeb 25, 2009
  2. Jeff KingFeb 25, 2009
  3. Junio C HamanoFeb 25, 2009
  4. John TapsellFeb 25, 2009
  5. Junio C HamanoFeb 25, 2009
  6. Jeff KingFeb 25, 2009
  7. Junio C HamanoFeb 25, 2009
  8. Jeff KingFeb 25, 2009
  9. John TapsellFeb 25, 2009
  10. Junio C HamanoFeb 25, 2009
  11. John TapsellFeb 25, 2009
  12. Jay SoffianFeb 25, 2009
  13. Junio C HamanoFeb 25, 2009
  14. Finn Arne GangstadFeb 25, 2009
  15. Andreas EricssonMar 5, 2009
  16. John TapsellMar 5, 2009
  17. Finn Arne GangstadMar 5, 2009

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.