Skip to contentSkip to conversation

git push <branch-name>

DISCUSSION Daniel Johnson 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines · On Tuesday 05 October 2010 16:29:50 you wrote:

A newbie colleague asked why: "git push <branch>" didn't work.

Although I know that "git push <repo> <branch>" is the correct syntax, I think that he has a point. If branch.<branch>.remote is defined it seems unambiguous to me.

So I can't see any reason NOT to dwimify

git push <branch>

Isn't that syntax reserved for remotes?
for example:

git push origin

I feel like it would be a bad idea to have these 2 types of invocations overlap in syntax like that.

#1 lore raw
Quoted 7 lines · Daniel Johnson

Isn't that syntax reserved for remotes?
for example:

git push origin

I feel like it would be a bad idea to have these 2 types of invocations overlap in syntax like that.

The idea is that given "git push <branch>" if <branch> is NOT a remote but IS a branch name then git could unambiguously provide the correct remote.

Naturally if there's a branch and a remote of the same name then for backwards compatibility the remote would be chosen.

#2 lore raw

Hi,

Quoted 6 lines · Eric Raible
Quoted 5 lines · Daniel Johnson

Isn't that syntax reserved for remotes?
for example:

git push origin

Quoted 8 lines
Quoted 2 lines

I feel like it would be a bad idea to have these 2 types of invocations overlap in syntax like that.

The idea is that given "git push <branch>" if <branch> is NOT a remote but IS a branch name then git could unambiguously provide the correct remote.

Naturally if there's a branch and a remote of the same name then for backwards compatibility the remote would be chosen.

Please don't do that. Imho, this introduces too much magic in the behavior of git-pull, making it less intuitive to understand and, thus error-prone.

Cheers,
Sebastian

Signature · 4 lines
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin