git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git push origin BRANCHNAME question
@ 2016-08-25 13:16 Ed Greenberg
  2016-08-25 17:50 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ed Greenberg @ 2016-08-25 13:16 UTC (permalink / raw)
  To: git

I think I understand this from the git-push man page, but I want to make 
sure:

I have two branches, master and develop.

If I am (accidentally) sitting on master, and issue 'git push origin 
develop', does this properly push develop to remote develop, or does it 
push master to remote develop (which seems to be bad, in the most common 
use case.)  ?

Thanks,

Ed


-- 
Ed Greenberg
Glens Falls, NY USA


^ permalink raw reply	[flat|nested] 4+ messages in thread

* git push origin BRANCHNAME question
@ 2016-08-25 13:24 Ed Greenberg
  0 siblings, 0 replies; 4+ messages in thread
From: Ed Greenberg @ 2016-08-25 13:24 UTC (permalink / raw)
  To: git

I think I understand this from the git-push man page, but I want to make 
sure:

I have two branches, master and develop.

If I am (accidentally) sitting on master, and issue 'git push origin 
develop', does this properly push develop to remote develop, or does it 
push master to remote develop (which seems to be bad, in the most common 
use case.)  ?

Thanks,

Ed


-- 
Ed Greenberg
Glens Falls, NY USA


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git push origin BRANCHNAME question
  2016-08-25 13:16 Ed Greenberg
@ 2016-08-25 17:50 ` Junio C Hamano
  2016-08-25 18:39   ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2016-08-25 17:50 UTC (permalink / raw)
  To: Ed Greenberg; +Cc: git

Ed Greenberg <edg@greenberg.org> writes:

> I think I understand this from the git-push man page, but I want to
> make sure:
>
> I have two branches, master and develop.
>
> If I am (accidentally) sitting on master, and issue 'git push origin
> develop', does this properly push develop to remote develop, or does
> it push master to remote develop (which seems to be bad, in the most
> common use case.)  ?

You can find it out yourself quite easily, I would think.

$ git init src
$ git init dst
$ cd src
$ git commit --allow-empty -m initial
$ git checkout -b develop
$ git commit --allow-empty -m second

$ git checkout master
$ git push ../dst develop
Counting objects: 3, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 226 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To ../dst
 * [new branch]      develop -> develop


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git push origin BRANCHNAME question
  2016-08-25 17:50 ` Junio C Hamano
@ 2016-08-25 18:39   ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2016-08-25 18:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ed Greenberg, git

On Thu, Aug 25, 2016 at 10:50:23AM -0700, Junio C Hamano wrote:

> Ed Greenberg <edg@greenberg.org> writes:
> 
> > I think I understand this from the git-push man page, but I want to
> > make sure:
> >
> > I have two branches, master and develop.
> >
> > If I am (accidentally) sitting on master, and issue 'git push origin
> > develop', does this properly push develop to remote develop, or does
> > it push master to remote develop (which seems to be bad, in the most
> > common use case.)  ?
> 
> You can find it out yourself quite easily, I would think.
> 
> $ git init src
> $ git init dst
> $ cd src
> $ git commit --allow-empty -m initial
> $ git checkout -b develop
> $ git commit --allow-empty -m second
> 
> $ git checkout master
> $ git push ../dst develop
> Counting objects: 3, done.
> Delta compression using up to 6 threads.
> Compressing objects: 100% (2/2), done.
> Writing objects: 100% (3/3), 226 bytes | 0 bytes/s, done.
> Total 3 (delta 1), reused 0 (delta 0)
> To ../dst
>  * [new branch]      develop -> develop

Yes, though I think the "why" is interesting here, too.

And the answer is that "develop" is a shortened refspec, whose full form
is more like "develop:develop". A name with no colon is always the local
source, and the implied destination is usually the same name on the
remote (though it can be changed via config). The third paragraph of
"<refspec>..." under OPTIONS in "git help push" covers this, though I do
think it is a little hard to follow.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-25 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25 13:24 git push origin BRANCHNAME question Ed Greenberg
  -- strict thread matches above, loose matches on Subject: below --
2016-08-25 13:16 Ed Greenberg
2016-08-25 17:50 ` Junio C Hamano
2016-08-25 18:39   ` Jeff King

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).