{"thread":{"id":"26306","subject":"pushing to a remote branch that one does not own","startedAt":"2011-01-19T18:16:51Z","lastAt":"2011-01-19T22:28:39Z","messageCount":4,"participants":["iani","Maaartin","Alexey Shumkin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"159651","messageId":"1295461011273-5940751.post@n2.nabble.com","threadId":"26306","inReplyTo":null,"subject":"pushing to a remote branch that one does not own","fromName":"iani","fromEmail":"zannos@gmail.com","sentAt":"2011-01-19T18:16:51Z","receivedAt":"2011-01-19T18:16:51Z","isPatch":false,"sender":{"key":"zannos@gmail.com","avatar":null},"body":"\nHello, \nI want to contribute via \"push\" to a branch which I have previously cloned\nfrom a remote repository. There is a problem: \n\nIf i create a new commit on branch \"master\", which coincides with\norigin/master, then I can push this commit simply with\n    git push\nHowever, if i switch to a different branch of the repository which was\ncloned, for example by doing:\n    git checkout origin/lilt \nThen I get the message: \n\"You are in 'detached HEAD' state. You can look around, make experimental\n... (etc)\"\nSo I HAVE to create my own new branch based on the one downloaded in order\nto start committing and pushing changes. My question is therefore: \n\nAm I strictly limited to committing only on the master / origin/master\nbranched, and forced to make a new branch for every branch that I cloned\nfrom the remote repo, or is there a way of making the heads of the remote\nbranches visible as local too? \n\nThanks, \n\nIannis Zannos\n\n\n-- \nView this message in context: http://git.661346.n2.nabble.com/pushing-to-a-remote-branch-that-one-does-not-own-tp5940751p5940751.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"159658","messageId":"4D373AA2.7000501@seznam.cz","threadId":"26306","inReplyTo":"1295461011273-5940751.post@n2.nabble.com","subject":"Re: pushing to a remote branch that one does not own","fromName":"Maaartin","fromEmail":"grajcar1@seznam.cz","sentAt":"2011-01-19T19:25:22Z","receivedAt":"2011-01-19T19:25:22Z","isPatch":false,"sender":{"key":"grajcar1@seznam.cz","avatar":null},"body":"On 11-01-19 19:16, iani wrote:\n>\n> Hello,\n> I want to contribute via \"push\" to a branch which I have previously cloned\n> from a remote repository. There is a problem:\n>\n> If i create a new commit on branch \"master\", which coincides with\n> origin/master, then I can push this commit simply with\n>     git push\n> However, if i switch to a different branch of the repository which was\n> cloned, for example by doing:\n>     git checkout origin/lilt\n> Then I get the message:\n> \"You are in 'detached HEAD' state. You can look around, make experimental\n> ... (etc)\"\n> So I HAVE to create my own new branch based on the one downloaded in order\n> to start committing and pushing changes. My question is therefore:\n>\n> Am I strictly limited to committing only on the master / origin/master\n\nAFAIK, there's nothing special about origin, except that it's already\nset up to track origin/master.\n\nYou can't commit to origin/lilt just like you can't commit to\norigin/master. Those remote branches are there to mirror corresponding\nbranches in the remote repo, so you can do things like\ngit diff master origin/master\n\n> branched, and forced to make a new branch for every branch that I cloned\n> from the remote repo, or is there a way of making the heads of the remote\n> branches visible as local too?\n\nAFAIK, using\ngit branch lilt origin/lilt\nyou create a local branch tracking the remote one. Then you can work\nwith it just like you work with master. You may want to have a look at\n.git/config for [branch <branchname>] sections or not. I'm quite a\nnewbie, but this works for me.\n"},{"id":"159668","messageId":"loom.20110119T205035-308@post.gmane.org","threadId":"26306","inReplyTo":"1295461011273-5940751.post@n2.nabble.com","subject":"Re: pushing to a remote branch that one does not own","fromName":"Alexey Shumkin","fromEmail":"zapped@mail.ru","sentAt":"2011-01-19T19:56:30Z","receivedAt":"2011-01-19T19:56:30Z","isPatch":false,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Am I strictly limited to committing only on the master / origin/master\n> branched, and forced to make a new branch for every branch that I cloned\n> from the remote repo, or is there a way of making the heads of the remote\n> branches visible as local too? \n> \n> Thanks, \n> \n> Iannis Zannos\n> \n\nMaybe you should read \"Pro Git\" book chapter 3 \"Git Branching\"\nhttp://progit.org/book/ch3-0.html\n(and look forward for chapter 3.5 \"Remote Branches\")?\n"},{"id":"159674","messageId":"1295476119964-5941621.post@n2.nabble.com","threadId":"26306","inReplyTo":"4D373AA2.7000501@seznam.cz","subject":"Re: pushing to a remote branch that one does not own","fromName":"iani","fromEmail":"zannos@gmail.com","sentAt":"2011-01-19T22:28:39Z","receivedAt":"2011-01-19T22:28:39Z","isPatch":false,"sender":{"key":"zannos@gmail.com","avatar":null},"body":"\nThanks a lot for the prompt answer. Following your advice I read the progit\nonline chapter about branches and it explained to me about git branch lilt\norigin/lilt as Maaartin explains. So I am testing it now. \n\nThanks\nIannis Z.\n-- \nView this message in context: http://git.661346.n2.nabble.com/pushing-to-a-remote-branch-that-one-does-not-own-tp5940751p5941621.html\nSent from the git mailing list archive at Nabble.com.\n"}]}