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

Re: [RFC PATCH] git push: Push nothing if no refspecs are given or configured

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 6, 2009, 15:27 UTC
Message-ID
<m3mybyisa1.fsf@localhost.localdomain>
In-Reply-To
<43d8ce650903060426y776474fi10acc5495b88fa7@mail.gmail.com>
John Tapsell <johnflux@gmail.com> writes:
Show 55 quoted lines
> 2009/3/6 Finn Arne Gangstad <finnag@pvv.org>:
>> On Fri, Mar 06, 2009 at 02:32:53AM -0800, Junio C Hamano wrote:
>>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>>
>>>> On Thu, 5 Mar 2009, Sverre Rabbelier wrote:
>>>>
>>>>> On Thu, Mar 5, 2009 at 23:25, Markus Heidelberg
>>>>> <markus.heidelberg@web.de> wrote:
>>>>>> Oh, I confused "config option" with "command line argument"...
>>>>>
>>>>> Right, I'd like to be able to do:
>>>>> $ git config push.iamnotretarded true
>>>>> $ git push
>>>>
>>>> LOL!  Sverre, you have a way to crack me up...
>>>
>>> I found it amusing, too.
>>>
>>> It may have some correlation with how well organized your work habit is,
>>> but I do not think it has much correlation with being retarded.  It is
>>> more about "'matching refs' is the perfect default for _my_ use pattern,
>>> don't mess with it, please".
>>
>> So here is my current WIP suggestion for a new "push.default"
>> variable, I am not sure if a single entry can express all useful
>> choices, or if it is a good idea to introduce more default choices
>> other than "nothing" (with the goal of making it the default in a
>> later release).
>>
>> I think all the values here make sense as a --option to git push
>> though (except --nothing...)
>>
>> Suggested new entry in config.txt:
>>
>> push.default::
>>        Defines the action git push should take if no refspec is given
>>        on the command line, no refspec is configured in the branch, and
>>        no refspec is implied by any of the options given on the command
>>        line.
>> +
>>        The term `current remote` means the remote configured for the current
>>        branch, or `origin` if no remote is set. `origin` is also used if
>>        you are not on a branch at all.
>> +
>> * `nothing` do not push anything
>> * `matching` push all matching branches to the current remote.
>>  All branches having the same name in both ends are considered to be
>>  matching. This is the default value.
>> * `same-remote` push all matching branches that are configured to use
>>  the current remote. Branches with no remote configuration are not pushed.
>> * `tracked` push all branches that are tracking a branch on the current
>>  remote to their counterpart.
> 
> How about 'current', to simply push the current the branch.  It could
> even prompt if it's not tracked yet.
Note that if you have configuration for <remote>, you can simply add
"remote.<remote>.push = HEAD" for pushing current branch only, and
"remote.<remote>.push = :" for current matching behavior.  Perhaps
"remote.<remote>.push = " works for push nothing?
 
> Most (all?) other revision control systems have this 'current'
> behaviour by default.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: John TapsellNext: Junio C Hamano
Message 17 of 23 in “git push: Push nothing if no refspecs are given or configured”
  1. git push: Push nothing if no refspecs are given or configuredFinn Arne Gangstad, Mar 5, 2009
  2. Sverre RabbelierMar 5, 2009
  3. Markus HeidelbergMar 5, 2009
  4. Markus HeidelbergMar 5, 2009
  5. Sverre RabbelierMar 5, 2009
  6. Johannes SchindelinMar 6, 2009
  7. Junio C HamanoMar 6, 2009
  8. Sverre RabbelierMar 6, 2009
  9. Finn Arne GangstadMar 6, 2009
  10. Johannes SchindelinMar 6, 2009
  11. Finn Arne GangstadMar 6, 2009
  12. Jakub NarebskiMar 6, 2009
  13. Junio C HamanoMar 6, 2009
  14. Johannes SchindelinMar 7, 2009
  15. Johannes SchindelinMar 6, 2009
  16. John TapsellMar 6, 2009
  17. Jakub NarebskiMar 6, 2009
  18. Junio C HamanoMar 5, 2009
  19. Johannes SchindelinMar 6, 2009
  20. Markus HeidelbergMar 9, 2009
  21. Johannes SchindelinMar 9, 2009
  22. Markus HeidelbergMar 9, 2009
  23. Jeff KingMar 9, 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.