git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Elijah Newren <newren@gmail.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Cc: Mathias Kunter <mathiaskunter@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git push doesn't use local branch name as default
Date: Fri, 28 May 2021 13:58:47 -0500	[thread overview]
Message-ID: <60b13d67cb8a7_e545b20876@natae.notmuch> (raw)
In-Reply-To: <CABPp-BEd2GAOSSAaUwMLhftiKsbFXmuszH_fXBbTY9nU=yWg9w@mail.gmail.com>

Elijah Newren wrote:
> On Fri, May 28, 2021 at 10:22 AM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:

> > Perhaps:
> >
> > --- a/Documentation/config/push.txt
> > +++ b/Documentation/config/push.txt
> > @@ -29,8 +29,8 @@ push.default::
> >    different from the local one.
> >  +
> >  When pushing to a remote that is different from the remote you normally
> > -pull from, work as `current`.  This is the safest option and is suited
> > -for beginners.
> > +pull from (typically "origin"), work as `current`.  This is the safest option
> > +and is suited for beginners.
> 
> This is certainly an improvement.  I wonder if it might still be
> considered ambiguous or hard to parse, though.

I am sure it is, just like plenty of the official documentation.

> If so, maybe something like:
> 
> If you have a default remote configured for the current branch

This is still very hard to parse, especially since there's no command to
"configure the remote of a branch" (AFAIK).

> and are pushing to a remote other than that one

And you've lost me.

I have to do a mental model of what's trying to be said:

  x && pushed != x

If x is nil, then I can't push to it, so this is the same as:

  pushed != x

> (or if you have no default remote configured and are pushing to a
> remote other than 'origin'),

So:

  !x && pushed != 'origin'

Altogether:

  (pushed != x) || (!x && pushed != 'origin')

So:

  pushed != (x || 'origin')

And we can use an x that is more friendly to users (and there are
commands to set it):

  If you are pushing to a remote that is not the same as the upstream
  branch, or 'origin'...

> then work as 'current'.

And now I have to read what `current` is.

The current documentation is trying to replicate what the convoluted
code is doing, your version is a little better, but not by much.


This is much more straightforward:

  pushes the current branch with the same name on the remote.

  If you are working on a centralized workflow--pushing to the same
  repository you pull from (typically `origin`)--then you need to
  configure an upstream branch with the same name.

When you describe the situation clearly (and not simply transcribe the
code), it becomes clear why users like Mathias don't see the current
behavior as sane.

I'm working on some patches so the issue becomes clear for those who
don't speak user.

Cheers.

-- 
Felipe Contreras

  reply	other threads:[~2021-05-28 18:58 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
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 [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=60b13d67cb8a7_e545b20876@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mathiaskunter@gmail.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).