{"thread":{"id":"17743","subject":"Strange branch merging.","startedAt":"2009-02-12T11:52:51Z","lastAt":"2009-02-12T13:08:07Z","messageCount":6,"participants":["Adam Panayis","Pieter de Bie","Sitaram Chamarty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"104375","messageId":"49940D93.6000204@movency.com","threadId":"17743","inReplyTo":null,"subject":"Strange branch merging.","fromName":"Adam Panayis","fromEmail":"adam@movency.com","sentAt":"2009-02-12T11:52:51Z","receivedAt":"2009-02-12T11:52:51Z","isPatch":false,"sender":{"key":"adam@movency.com","avatar":null},"body":"Hi, I have just started using git and am having  a problem with 2 \nbranches appearing merged.\n\nI have a local machine, on this I have 2 branches. The master and one \nnamed blah. My git repository is in the following location: /git/.git/\n\nI have made changes to a file on the blah branch and committed these \nchanges.\n\nI checkout the master branch and as expected the changes are no longer \nthere. I flip back to blah and I can see my changes. So far so good.\n\nI then, on a remote machine use the pull command, the remote machine \nshows only the master branch as I have not asked it to pull blah. The \ncommand I use is as follows: git pull -v ssh://user@machine one/git/.git/\n\nOnce this is done I double check my branches and it shows I still only \nhave the master. Perfect. However, when I check the file I edited on my \nlocal machine on the blah branch, the changes are there.\n\nAm I fundamentally misunderstanding the correct usage of git? Is this \nresult expected?\n\nThanks\n"},{"id":"104376","messageId":"E65A809A-65AD-4755-8AA7-32AA11C9AB5A@frim.nl","threadId":"17743","inReplyTo":"49940D93.6000204@movency.com","subject":"Re: Strange branch merging.","fromName":"Pieter de Bie","fromEmail":"pieter@frim.nl","sentAt":"2009-02-12T12:27:58Z","receivedAt":"2009-02-12T12:27:58Z","isPatch":false,"sender":{"key":"pieter@frim.nl","avatar":null},"body":"\nOn Feb 12, 2009, at 11:52 AM, Adam Panayis wrote:\n\n> Once this is done I double check my branches and it shows I still  \n> only have the master. Perfect. However, when I check the file I  \n> edited on my local machine on the blah branch, the changes are there.\n>\n> Am I fundamentally misunderstanding the correct usage of git? Is  \n> this result expected?\n\nYes, git pull will never change anything on the remote side. You  \nshould use 'git push' for that. But, you shouldn't push to repository  \nwith a working directory unless you know what you're doing -- read http://git.or.cz/gitwiki/GitFaq#non-bare \n  for that.\n\n- Pieter\n"},{"id":"104378","messageId":"499418A4.9060401@movency.com","threadId":"17743","inReplyTo":"E65A809A-65AD-4755-8AA7-32AA11C9AB5A@frim.nl","subject":"Re: Strange branch merging.","fromName":"Adam Panayis","fromEmail":"adam@movency.com","sentAt":"2009-02-12T12:40:04Z","receivedAt":"2009-02-12T12:40:04Z","isPatch":false,"sender":{"key":"adam@movency.com","avatar":null},"body":"Pieter, thanks for your advice.\n\nI am never using the push command here.\n\nBox A has branches master and blah.\nOn Box B I just want to pull branch master.\n\nWhen I try to do that on box B I get the master branch from box A but I \nget the changes made to branch blah on box A.\n\nI do not understand why, on box B, the master branch is showing changes \nmade to the blah branch on box A. (Yet on box A the changes to the blah \nbranch are not shown in the master)\n\nApologies for my babbling.\n\nAdam\n\nPieter de Bie wrote:\n>\n> On Feb 12, 2009, at 11:52 AM, Adam Panayis wrote:\n>\n>> Once this is done I double check my branches and it shows I still \n>> only have the master. Perfect. However, when I check the file I \n>> edited on my local machine on the blah branch, the changes are there.\n>>\n>> Am I fundamentally misunderstanding the correct usage of git? Is this \n>> result expected?\n>\n> Yes, git pull will never change anything on the remote side. You \n> should use 'git push' for that. But, you shouldn't push to repository \n> with a working directory unless you know what you're doing -- read \n> http://git.or.cz/gitwiki/GitFaq#non-bare for that.\n>\n> - Pieter\n"},{"id":"104379","messageId":"FADBCA93-6742-43E8-A4A6-0090FBFF8BAB@frim.nl","threadId":"17743","inReplyTo":"499418A4.9060401@movency.com","subject":"Re: Strange branch merging.","fromName":"Pieter de Bie","fromEmail":"pieter@frim.nl","sentAt":"2009-02-12T12:42:47Z","receivedAt":"2009-02-12T12:42:47Z","isPatch":false,"sender":{"key":"pieter@frim.nl","avatar":null},"body":"Hey,\n\n[ Please don't top-post here, it makes following the discussion harder ]\n\nOn Feb 12, 2009, at 12:40 PM, Adam Panayis wrote:\n> When I try to do that on box B I get the master branch from box A  \n> but I get the changes made to branch blah on box A.\n>\n> I do not understand why, on box B, the master branch is showing  \n> changes made to the blah branch on box A. (Yet on box A the changes  \n> to the blah branch are not shown in the master)\n\nYou probably pulled in the 'blah' branch rather than the 'master'  \nbranch because that was\nthe branch that is checked out on box A. You can verify this by  \nlooking at 'git log' and\nsee that the commit on the blah branch is also there. To pull the  \nmaster branch, specify\nit explicitly, like this:\n\n\tgit pull boxA:path/to/repo master\n\n- Pieter\n"},{"id":"104382","messageId":"49941D4C.80502@movency.com","threadId":"17743","inReplyTo":"FADBCA93-6742-43E8-A4A6-0090FBFF8BAB@frim.nl","subject":"Re: Strange branch merging.","fromName":"Adam Panayis","fromEmail":"adam@movency.com","sentAt":"2009-02-12T12:59:56Z","receivedAt":"2009-02-12T12:59:56Z","isPatch":false,"sender":{"key":"adam@movency.com","avatar":null},"body":"Pieter de Bie wrote:\n> Hey,\n>\n> [ Please don't top-post here, it makes following the discussion harder ]\n>\n> On Feb 12, 2009, at 12:40 PM, Adam Panayis wrote:\n>> When I try to do that on box B I get the master branch from box A but \n>> I get the changes made to branch blah on box A.\n>>\n>> I do not understand why, on box B, the master branch is showing \n>> changes made to the blah branch on box A. (Yet on box A the changes \n>> to the blah branch are not shown in the master)\n>\n> You probably pulled in the 'blah' branch rather than the 'master' \n> branch because that was\n> the branch that is checked out on box A. You can verify this by \n> looking at 'git log' and\n> see that the commit on the blah branch is also there. To pull the \n> master branch, specify\n> it explicitly, like this:\n>\n>     git pull boxA:path/to/repo master\n>\n> - Pieter\nPieter, thank you very much. Looks like that is indeed the mistake I was \nmaking.\n"},{"id":"104383","messageId":"slrngp87pn.50p.sitaramc@sitaramc.homelinux.net","threadId":"17743","inReplyTo":"49940D93.6000204@movency.com","subject":"Re: Strange branch merging.","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-02-12T13:08:07Z","receivedAt":"2009-02-12T13:08:07Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-02-12, Adam Panayis <adam@movency.com> wrote:\n> I have a local machine, on this I have 2 branches. The master and one \n> named blah. My git repository is in the following location: /git/.git/\n>\n> I have made changes to a file on the blah branch and committed these \n> changes.\n>\n> I checkout the master branch and as expected the changes are no longer \n> there. I flip back to blah and I can see my changes. So far so good.\n>\n> I then, on a remote machine use the pull command, the remote machine \n> shows only the master branch as I have not asked it to pull blah. The \n> command I use is as follows: git pull -v ssh://user@machine one/git/.git/\n>\n> Once this is done I double check my branches and it shows I still only \n> have the master. Perfect. However, when I check the file I edited on my \n> local machine on the blah branch, the changes are there.\n\nOn the remote machine, your current branch was 'master'.\nWhen you did a 'git pull', whatever you did would affect\nthis branch.  Meanwhile, the currently checked-out branch on\nthe other side was 'blah', which is what came in.\n\nWhat you need to do is add the word 'master' to the 'git\npull...' command you used.  This will ensure that,\nregardless of what the currently checkedout branch on the\nsending side is, you will get the master branch.\n"}]}