git push interface inconsistency

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

git push interface inconsistency

From: Eugene Sajine <hidden>
Date: 2016-06-15 22:47:37

Hi,

I have a question:

Why I can't do

$ git push my_tag

It will fail because the remote is not specified, even if there is
only one origin remote

but can do

$ git push --tags

and it will push tags to origin...

Thanks,
Eugene

Re: git push interface inconsistency

From: Avery Pennarun <hidden>
Date: 2016-06-15 22:47:37

On Mon, Oct 26, 2009 at 6:25 PM, Eugene Sajine [off-list ref] wrote:
I have a question:

Why I can't do

$ git push my_tag

It will fail because the remote is not specified, even if there is
only one origin remote

but can do

$ git push --tags

and it will push tags to origin...
Because 'my_tag' is interpreted as the name or URL of the remote, not
as a branch name.  You can do "git push origin" and it will guess the
branch name(s) to push, but because of that, the one-parameter push
can't *also* be used to guess the remote name.

In contrast, --tags is a flag, so it's actually the zero-parameter
version of push, which assumes 'origin' and then guesses the branch
name (and --tags changes the guessed result).

Hope that helps.

Have fun,

Avery

Re: git push interface inconsistency

From: Eugene Sajine <hidden>
Date: 2016-06-15 22:47:37

Got it.


Thanks!

On Mon, Oct 26, 2009 at 6:31 PM, Avery Pennarun [off-list ref] wrote:
On Mon, Oct 26, 2009 at 6:25 PM, Eugene Sajine [off-list ref] wrote:
quoted
I have a question:

Why I can't do

$ git push my_tag

It will fail because the remote is not specified, even if there is
only one origin remote

but can do

$ git push --tags

and it will push tags to origin...
Because 'my_tag' is interpreted as the name or URL of the remote, not
as a branch name.  You can do "git push origin" and it will guess the
branch name(s) to push, but because of that, the one-parameter push
can't *also* be used to guess the remote name.

In contrast, --tags is a flag, so it's actually the zero-parameter
version of push, which assumes 'origin' and then guesses the branch
name (and --tags changes the guessed result).

Hope that helps.

Have fun,

Avery
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help