Re: [PATCH] push: error out when the "upstream" semantics does not make sense

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Junio C Hamano <gitster@xxxxxxxxx> writes:

>> "To push the current branch to this remote, run:
>>
>>   git push <remote> <branch>
>>
>> "
>
> I am afraid that the above advice is a lot worse than leaving it unsaid.
>
> We are in no position to assume that the user wanted the "current"
> semantics when we issue this message.  Otherwise, we would be better off
> switching the default semantics to "current", not "upstream".  But the
> working assumption in this series is that "upstream" is an improvement
> over "current", no?

I'm not sure. I do support "upstream", but I also think that in many
(most?) cases, the user will want to set "upstream" to point to the
branch with the same name. If there is any confusion between "current"
and "upstream", then avoiding situations where they do something
different is not stupid. This is already what we do when there is no
upstream configured at all:

  $ git push origin
  fatal: The current branch master has no upstream branch.
  To push the current branch and set the remote as upstream, use
  
      git push --set-upstream origin master

OTOH, if the user sees this message, he already has several remotes
configured, and we can probably expect him not to be a total newbie.
Then suggesting

  "git push --set-upstream %s %s:<remote-branch-name>", remote->name, branch->name

would make sense.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Newbies FAQ]     [Linux Kernel Development]     [Free Online Dating]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Free Online Dating]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]     [Linux Resources]

Add to Google