{"thread":{"id":"43931","subject":"git push origin BRANCHNAME question","startedAt":"2016-08-25T13:16:57Z","lastAt":"2016-08-25T18:46:39Z","messageCount":3,"participants":["Ed Greenberg","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"300157","messageId":"6c4fbb7d-6f67-b454-2b4b-9f5fbeffae9b@greenberg.org","threadId":"43931","inReplyTo":null,"subject":"git push origin BRANCHNAME question","fromName":"Ed Greenberg","fromEmail":"edg@greenberg.org","sentAt":"2016-08-25T13:16:50Z","receivedAt":"2016-08-25T13:16:57Z","isPatch":false,"sender":{"key":"edg@greenberg.org","avatar":"https://gravatar.com/avatar/d92c2e6aa2a0a80cc9a3492aa2d13ff98a73c5d420bfe98d51b9ba467ce10706?d=mp&s=160"},"body":"I think I understand this from the git-push man page, but I want to make \nsure:\n\nI have two branches, master and develop.\n\nIf I am (accidentally) sitting on master, and issue 'git push origin \ndevelop', does this properly push develop to remote develop, or does it \npush master to remote develop (which seems to be bad, in the most common \nuse case.)  ?\n\nThanks,\n\nEd\n\n\n-- \nEd Greenberg\nGlens Falls, NY USA\n\n"},{"id":"300178","messageId":"xmqqr39cn3fk.fsf@gitster.mtv.corp.google.com","threadId":"43931","inReplyTo":"6c4fbb7d-6f67-b454-2b4b-9f5fbeffae9b@greenberg.org","subject":"Re: git push origin BRANCHNAME question","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-25T17:50:23Z","receivedAt":"2016-08-25T17:50:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ed Greenberg <edg@greenberg.org> writes:\n\n> I think I understand this from the git-push man page, but I want to\n> make sure:\n>\n> I have two branches, master and develop.\n>\n> If I am (accidentally) sitting on master, and issue 'git push origin\n> develop', does this properly push develop to remote develop, or does\n> it push master to remote develop (which seems to be bad, in the most\n> common use case.)  ?\n\nYou can find it out yourself quite easily, I would think.\n\n$ git init src\n$ git init dst\n$ cd src\n$ git commit --allow-empty -m initial\n$ git checkout -b develop\n$ git commit --allow-empty -m second\n\n$ git checkout master\n$ git push ../dst develop\nCounting objects: 3, done.\nDelta compression using up to 6 threads.\nCompressing objects: 100% (2/2), done.\nWriting objects: 100% (3/3), 226 bytes | 0 bytes/s, done.\nTotal 3 (delta 1), reused 0 (delta 0)\nTo ../dst\n * [new branch]      develop -> develop\n\n"},{"id":"300182","messageId":"20160825183928.jm7pihc4kzwuej6y@sigill.intra.peff.net","threadId":"43931","inReplyTo":"xmqqr39cn3fk.fsf@gitster.mtv.corp.google.com","subject":"Re: git push origin BRANCHNAME question","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-08-25T18:39:28Z","receivedAt":"2016-08-25T18:46:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 25, 2016 at 10:50:23AM -0700, Junio C Hamano wrote:\n\n> Ed Greenberg <edg@greenberg.org> writes:\n> \n> > I think I understand this from the git-push man page, but I want to\n> > make sure:\n> >\n> > I have two branches, master and develop.\n> >\n> > If I am (accidentally) sitting on master, and issue 'git push origin\n> > develop', does this properly push develop to remote develop, or does\n> > it push master to remote develop (which seems to be bad, in the most\n> > common use case.)  ?\n> \n> You can find it out yourself quite easily, I would think.\n> \n> $ git init src\n> $ git init dst\n> $ cd src\n> $ git commit --allow-empty -m initial\n> $ git checkout -b develop\n> $ git commit --allow-empty -m second\n> \n> $ git checkout master\n> $ git push ../dst develop\n> Counting objects: 3, done.\n> Delta compression using up to 6 threads.\n> Compressing objects: 100% (2/2), done.\n> Writing objects: 100% (3/3), 226 bytes | 0 bytes/s, done.\n> Total 3 (delta 1), reused 0 (delta 0)\n> To ../dst\n>  * [new branch]      develop -> develop\n\nYes, though I think the \"why\" is interesting here, too.\n\nAnd the answer is that \"develop\" is a shortened refspec, whose full form\nis more like \"develop:develop\". A name with no colon is always the local\nsource, and the implied destination is usually the same name on the\nremote (though it can be changed via config). The third paragraph of\n\"<refspec>...\" under OPTIONS in \"git help push\" covers this, though I do\nthink it is a little hard to follow.\n\n-Peff\n"}]}