{"thread":{"id":"31878","subject":"Report a bug, about track remote repository.","startedAt":"2012-10-20T18:49:57Z","lastAt":"2012-10-21T02:44:05Z","messageCount":3,"participants":["Cheeray Huang","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201597","messageId":"5082F255.9060600@gmail.com","threadId":"31878","inReplyTo":null,"subject":"Report a bug, about track remote repository.","fromName":"Cheeray Huang","fromEmail":"cheeray.huang@gmail.com","sentAt":"2012-10-20T18:49:57Z","receivedAt":"2012-10-20T18:49:57Z","isPatch":false,"sender":{"key":"cheeray.huang@gmail.com","avatar":null},"body":"Hi,\n\nI think I found a bug, when I used local branches to track remote \nbranch. But I'm not very sure, can anyone double check this?  I'd like \nto finger this out. I think you can reproduce this bug as below steps:\n\nprecondition:\n\nSuppose that you have a remote branch in repository, named origin/work. \nAnd then you want to track it with a local branch.\n\nSteps:\n\n1. So you can do this:\n\ngit checkout -t origin/work\n\nnow, you have a local branch also named \"work\" to track \"origin/work\".\nIt works nicely, you can use \"push/pull\" command without any detail \nparameters to sync anything with the remote branch.\n\n2. Create another branch, ex. named \"work2\", to track \"origin/work\" \nagain, though maybe there are not so many people that will do like this.\n\nYou will find that local branch \"work2\" can't \"push\" to \"origin/work\".\nex. After you committed something in work2, you typed \"git status\", git \nwould tell you:\n\nYour branch is ahead of 'origin/work' by x commit.\n\nAnd then you used \"git push\", git can't display the information about \nchanging hash value in remote branch, just printed \"everything is up to \ndate\".\n\nActually, you can use some exact parameters to solve this,  such as:\n\ngit push origin work2:work\n\nBut, I still think it is a bug.\n\nBTW, I found this bug when I used github. I don't know whether it is  \nrelated to github.\n\n\n-- \nB&R,\nCheeray\n"},{"id":"201602","messageId":"F15116C3B49A439AB06C8068F79E4C0F@PhilipOakley","threadId":"31878","inReplyTo":"5082F255.9060600@gmail.com","subject":"Re: Report a bug, about track remote repository.","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2012-10-20T23:46:20Z","receivedAt":"2012-10-20T23:46:20Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Cheeray Huang\" <cheeray.huang@gmail.com>\n> Hi,\n>\n> I think I found a bug, when I used local branches to track remote \n> branch. But I'm not very sure, can anyone double check this?  I'd like \n> to finger this out. I think you can reproduce this bug as below steps:\n>\n> precondition:\n>\n> Suppose that you have a remote branch in repository, named \n> origin/work. And then you want to track it with a local branch.\n>\n> Steps:\n>\n> 1. So you can do this:\n>\n> git checkout -t origin/work\n>\n> now, you have a local branch also named \"work\" to track \"origin/work\".\n> It works nicely, you can use \"push/pull\" command without any detail \n> parameters to sync anything with the remote branch.\n>\n> 2. Create another branch, ex. named \"work2\", to track \"origin/work\" \n> again, though maybe there are not so many people that will do like \n> this.\n\nAt this point you have created the 'conflict' - You can't have two \ndifferent branches that both track the same identical remote branch and \nexpect that they can be both different and identical at the same time.\n\n>\n> You will find that local branch \"work2\" can't \"push\" to \"origin/work\".\n> ex. After you committed something in work2, you typed \"git status\", \n> git would tell you:\n>\n> Your branch is ahead of 'origin/work' by x commit.\n>\n> And then you used \"git push\", git can't display the information about \n> changing hash value in remote branch, just printed \"everything is up \n> to date\".\n\nOnly one push (from two branches trying) can suceed. You either force \nthe remote to match the current branch, and loose any information that \nit had about the other branch, or the remote stays with one branch. \nSimply don't do it [that way]. If the local branches are different, then \nyou need distinct remote branches.\n\n>\n> Actually, you can use some exact parameters to solve this,  such as:\n>\n> git push origin work2:work\n>\n> But, I still think it is a bug.\n>\n> BTW, I found this bug when I used github. I don't know whether it is \n> related to github.\n>\n>\n> -- \n> B&R,\n> Cheeray\n"},{"id":"201606","messageId":"50836175.5020501@gmail.com","threadId":"31878","inReplyTo":"F15116C3B49A439AB06C8068F79E4C0F@PhilipOakley","subject":"Re: Report a bug, about track remote repository.","fromName":"Cheeray Huang","fromEmail":"cheeray.huang@gmail.com","sentAt":"2012-10-21T02:44:05Z","receivedAt":"2012-10-21T02:44:05Z","isPatch":false,"sender":{"key":"cheeray.huang@gmail.com","avatar":null},"body":"On 2012年10月21日 07:46, Philip Oakley wrote:\n>\n> At this point you have created the 'conflict' - You can't have two \n> different branches that both track the same identical remote branch \n> and expect that they can be both different and identical at the same \n> time.\n\n> Only one push (from two branches trying) can suceed. You either force \n> the remote to match the current branch, and loose any information that \n> it had about the other branch, or the remote stays with one branch. \n> Simply don't do it [that way]. If the local branches are different, \n> then you need distinct remote branches.\n\nYes, if it will lead a conflict, I think git should give a warning for \nit and prevent these operations rather than give a comment to inform you \nto push something.\n\n\n\n-- \nBest Regards!\n\nQiyu Huang( Cheeray )\n"}]}