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

Re: [PATCH] git-push.txt: document the behavior of --repo

From
PMPrem Muthedath <prem.muthedath@gmail.com>
Date
Jan 28, 2015, 16:20 UTC
Message-ID
<CAHQ-GLCBXFtLxDME83Qxbw_w1sPaKONzC8xrboh9v+jtEb7-Vw@mail.gmail.com>
In-Reply-To
<CAPig+cQCf+vKbZ5ydFSNmGCUvmCkQW-DEPhO1JAAap1VorhXsA@mail.gmail.com>

Hello Junio, Michael -- thanks much for clearing this up for me. Appreciate your time.

If the --repo option works just like the <repository> argument to git push, then I would suggest -- just as Junio has done -- that you deprecate this option. Otherwise, it would confuse users.

There is also a minor typo that I noticed in the push documentation that you may want to correct. In the "Examples" section in git push manual for git 2.2.2 (see paragraph below), instead of "remote.origin.merge", I think it should be "branch.<name>.merge" configuration variable.

git push origin Without additional configuration, pushes the current branch to the configured upstream (remote.origin.merge configuration variable) if it has the same name as the current branch, and errors out without pushing otherwise.

Thanks, Prem

On Wed, Jan 28, 2015 at 3:37 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 50 quoted lines
> On Tue, Jan 27, 2015 at 7:35 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> As per the code, the --repo <repo> option is equivalent to the <repo>
>> argument to 'git push'. [It exists for historical reasons, back from the time
>> when options had to come before arguments.]
>>
>> Say so. [But not that.]
>>
>> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
>> ---
>> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
>> index ea97576..0ad31c4 100644
>> --- a/Documentation/git-push.txt
>> +++ b/Documentation/git-push.txt
>> @@ -219,22 +219,8 @@ origin +master` to force a push to the `master` branch). See the
>>  `<refspec>...` section above for details.
>>
>>  --repo=<repository>::
>> -       This option is only relevant if no <repository> argument is
>> -       passed in the invocation. In this case, 'git push' derives the
>> -       remote name from the current branch: If it tracks a remote
>> -       branch, then that remote repository is pushed to. Otherwise,
>> -       the name "origin" is used. For this latter case, this option
>> -       can be used to override the name "origin". In other words,
>> -       the difference between these two commands
>> -+
>> ---------------------------
>> -git push public         #1
>> -git push --repo=public  #2
>> ---------------------------
>> -+
>> -is that #1 always pushes to "public" whereas #2 pushes to "public"
>> -only if the current branch does not track a remote branch. This is
>> -useful if you write an alias or script around 'git push'.
>> +       This option is equivalent to the <repository> argument; the latter
>> +       wins if both are specified.
>
> To what does "latter" refer in this case? (I presume it means the
> standalone <repository> argument, though the text feels ambiguous.)
>
> Also, both the standalone argument and the right-hand-side of --repo=
> are spelled "<repository>", so there may be potential for confusion
> when talking about <repository> (despite the subsequent "argument").
> Perhaps qualifying it as "_standalone_ <repository> argument" might
> help.
>
>>  -u::
>>  --set-upstream::
>> --
>> 2.3.0.rc1.222.gae238f2
Previous: Eric SunshineNext: Junio C Hamano
Message 6 of 9 in “git push --repo option not working as described in git manual.”
  1. PremJan 26, 2015
  2. Junio C HamanoJan 26, 2015
  3. git-push.txt: document the behavior of --repoMichael J Gruber, Jan 27, 2015
  4. Junio C HamanoJan 27, 2015
  5. Eric SunshineJan 27, 2015
  6. Prem MuthedathJan 28, 2015
  7. Junio C HamanoJan 28, 2015
  8. Eric SunshineJan 28, 2015
  9. Junio C HamanoJan 28, 2015

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.