All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Kunter <mathiaskunter@gmail.com>
To: Elijah Newren <newren@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git push doesn't use local branch name as default
Date: Fri, 28 May 2021 10:51:22 +0200	[thread overview]
Message-ID: <287483ba-d682-6d04-23fa-22c33ab70376@gmail.com> (raw)
In-Reply-To: <f9f38d42-2b93-0d3b-798b-4c6f44eb111d@gmail.com>

Note that git itself also claims this should be working. If I do a "git 
push" on a branch without upstream, I will get:

> fatal: No configured push destination.
> Either specify the URL from the command-line or configure a remote repository using
> 
>     git remote add <name> <url>
> 
> and then push using the remote name
> 
>     git push <name>

However, the advised "git push <name>" command won't work on that branch 
with the default settings of Git. To make it work, `simple` pushing 
would have to use `current` behavior on a branch without upstream.

Please consider changing that. Thank you.

Cheers
Mathias Kunter


Am 28.05.21 um 09:44 schrieb Mathias Kunter:
>> you only get the "current" behavior when fetch_remote is non-NULL.
> 
> Well, then my suggestion actually is to also use the `current` behavior 
> when fetch_remote is NULL - i.e. change
> 
>> return (fetch_remote && fetch_remote != remote);
> 
> to
> 
>> return (!fetch_remote || fetch_remote != remote);
> 
> I'd argue that if `simple` pushing is used, then the expected behavior 
> of the command
> 
>> git push <remote_name>
> 
> on a branch without upstream would actually be to use the `current` 
> behavior instead of bailing out with an error.
> 
> 
> Am 28.05.21 um 09:00 schrieb Elijah Newren:
>> On Thu, May 27, 2021 at 11:39 PM Mathias Kunter 
>> <mathiaskunter@gmail.com> wrote:
>>>
>>> Felipe,
>>>
>>> thanks for your reply.
>>>
>>>> Sounds like you want to change the default to `push.default=current`.
>>>
>>> Yes, but shouldn't `simple` pushing also work? The documentation says
>>> about `push.default=simple`:
>>>
>>>> When pushing to a remote that is different from the remote you normally
>>>> pull from, work as `current`.
>>
>> Perhaps this wording should be clarified to read
>>
>> When you have a remote that you normally pull from but you are pushing
>> to a different remote then that one, then work as 'current'.
>>
>>> If there is no upstream, then there also is no "remote I normally pull
>>> from", and thus, according to the doc, `simple` should actually work
>>> like `current` in this case. Am I wrong here?
>>
>> The relevant code is
>>
>>      return (fetch_remote && fetch_remote != remote);
>>
>> so you only get the "current" behavior when fetch_remote is non-NULL.
>>

  reply	other threads:[~2021-05-28  8:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3b9bc214-a30a-ba49-af96-7eeaf37b7bbd@gmail.com>
2021-05-28  6:29 ` git push doesn't use local branch name as default Mathias Kunter
2021-05-28  7:00   ` Elijah Newren
2021-05-28  7:44     ` Mathias Kunter
2021-05-28  8:51       ` Mathias Kunter [this message]
2021-05-28 21:12         ` git push default doesn't make sense Felipe Contreras
2021-05-30 16:28           ` Mathias Kunter
2021-05-30 16:32             ` Felipe Contreras
2021-05-28 17:52       ` git push doesn't use local branch name as default Felipe Contreras
2021-05-28 17:22     ` Felipe Contreras
2021-05-28 17:44       ` Elijah Newren
2021-05-28 18:58         ` Felipe Contreras
2021-05-28 17:10   ` Felipe Contreras
2021-05-27 17:06 Mathias Kunter
2021-05-27 19:51 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=287483ba-d682-6d04-23fa-22c33ab70376@gmail.com \
    --to=mathiaskunter@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.