{"thread":{"id":"19818","subject":"How can i find the origin of a branch?","startedAt":"2009-06-15T11:37:02Z","lastAt":"2009-06-15T13:34:30Z","messageCount":7,"participants":["Dotan Barak","Alex Riesen","Kristian Amlie"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"116326","messageId":"2f3bf9a60906150437v765c2cecva61307ae9cf0cec7@mail.gmail.com","threadId":"19818","inReplyTo":null,"subject":"How can i find the origin of a branch?","fromName":"Dotan Barak","fromEmail":"dotanba@gmail.com","sentAt":"2009-06-15T11:37:02Z","receivedAt":"2009-06-15T11:37:02Z","isPatch":false,"sender":{"key":"dotanba@gmail.com","avatar":null},"body":"Hi.\n\nIs it possible to find the origin of a branch?\n(the remote repository that this branch was cloned and checked out from)\n\n\nThanks\nDotan\n"},{"id":"116330","messageId":"4A363741.9030604@nokia.com","threadId":"19818","inReplyTo":"2f3bf9a60906150437v765c2cecva61307ae9cf0cec7@mail.gmail.com","subject":"Re: How can i find the origin of a branch?","fromName":"Kristian Amlie","fromEmail":"kristian.amlie@nokia.com","sentAt":"2009-06-15T11:57:53Z","receivedAt":"2009-06-15T11:57:53Z","isPatch":false,"sender":{"key":"kristian.amlie@nokia.com","avatar":null},"body":"ext Dotan Barak wrote:\n> Hi.\n> \n> Is it possible to find the origin of a branch?\n> (the remote repository that this branch was cloned and checked out from)\n\ngit config -l\n\nAssuming you're on the master branch, branch.master.remote and\nbranch.master.merge will tell you which remote and which branch you are\ntracking. Assuming that the remote is origin, you can check\nremote.origin.url to see the URL of the repo.\n\n--\nKristian\n"},{"id":"116331","messageId":"2f3bf9a60906150503p69e992b4m18bdc2cc842b933e@mail.gmail.com","threadId":"19818","inReplyTo":"4A363741.9030604@nokia.com","subject":"Re: How can i find the origin of a branch?","fromName":"Dotan Barak","fromEmail":"dotanba@gmail.com","sentAt":"2009-06-15T12:03:57Z","receivedAt":"2009-06-15T12:03:57Z","isPatch":false,"sender":{"key":"dotanba@gmail.com","avatar":null},"body":"Thank you very much for a quick and exact answer\n:)\n\nDotan\n\n\nOn Mon, Jun 15, 2009 at 2:57 PM, Kristian Amlie<kristian.amlie@nokia.com> wrote:\n> ext Dotan Barak wrote:\n>> Hi.\n>>\n>> Is it possible to find the origin of a branch?\n>> (the remote repository that this branch was cloned and checked out from)\n>\n> git config -l\n>\n> Assuming you're on the master branch, branch.master.remote and\n> branch.master.merge will tell you which remote and which branch you are\n> tracking. Assuming that the remote is origin, you can check\n> remote.origin.url to see the URL of the repo.\n>\n> --\n> Kristian\n>\n"},{"id":"116329","messageId":"81b0412b0906150507r7b141951w7246b0abab9624e2@mail.gmail.com","threadId":"19818","inReplyTo":"2f3bf9a60906150437v765c2cecva61307ae9cf0cec7@mail.gmail.com","subject":"Re: How can i find the origin of a branch?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-06-15T12:07:23Z","receivedAt":"2009-06-15T12:07:23Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2009/6/15 Dotan Barak <dotanba@gmail.com>:\n> Is it possible to find the origin of a branch?\n> (the remote repository that this branch was cloned and checked out from)\n\nLook for a repository which has the smallest count of commits\nin common with the branch.\n\nYou can use git merge-base to find all the commits which could\npossible be the point of divergence (aka \"merge base\"). Then\nyou can find all the remote branches which have the \"merge bases\"\n(git branch --contains <base>). Any of that remote branches\ncould have been the origin of your local branch.\n\nYou'll seldom (if ever again) need that, I think.\n\nP.S. You don't clone branches. Not as such. You clone repositories,\nwhich have the commits, which a branch (as in \"reference\") can point to.\n"},{"id":"116333","messageId":"81b0412b0906150548m69abc1bax785a4743119804c6@mail.gmail.com","threadId":"19818","inReplyTo":"4A363741.9030604@nokia.com","subject":"Re: How can i find the origin of a branch?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-06-15T12:48:21Z","receivedAt":"2009-06-15T12:48:21Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2009/6/15 Kristian Amlie <kristian.amlie@nokia.com>:\n> ext Dotan Barak wrote:\n>>\n>> Is it possible to find the origin of a branch?\n>> (the remote repository that this branch was cloned and checked out from)\n>\n> git config -l\n>\n> Assuming you're on the master branch, branch.master.remote and\n> branch.master.merge will tell you which remote and which branch you are\n> tracking. Assuming that the remote is origin, you can check\n> remote.origin.url to see the URL of the repo.\n\nExcept when it is just happen to have the same name.\nIOW, it is a BIG oversimplification.\n"},{"id":"116335","messageId":"4A36484A.3040207@nokia.com","threadId":"19818","inReplyTo":"81b0412b0906150548m69abc1bax785a4743119804c6@mail.gmail.com","subject":"Re: How can i find the origin of a branch?","fromName":"Kristian Amlie","fromEmail":"kristian.amlie@nokia.com","sentAt":"2009-06-15T13:10:34Z","receivedAt":"2009-06-15T13:10:34Z","isPatch":false,"sender":{"key":"kristian.amlie@nokia.com","avatar":null},"body":"ext Alex Riesen wrote:\n> 2009/6/15 Kristian Amlie <kristian.amlie@nokia.com>:\n>> ext Dotan Barak wrote:\n>>> Is it possible to find the origin of a branch?\n>>> (the remote repository that this branch was cloned and checked out from)\n>> git config -l\n>>\n>> Assuming you're on the master branch, branch.master.remote and\n>> branch.master.merge will tell you which remote and which branch you are\n>> tracking. Assuming that the remote is origin, you can check\n>> remote.origin.url to see the URL of the repo.\n> \n> Except when it is just happen to have the same name.\n> IOW, it is a BIG oversimplification.\n\nProbably, but why make the simple case overcomplicated? It should give\nyou the answer in 90% of the cases.\n\n--\nKristian\n"},{"id":"116337","messageId":"2f3bf9a60906150634p18e67e71q6e5e7cbb8df1d8c4@mail.gmail.com","threadId":"19818","inReplyTo":"2f3bf9a60906150503p69e992b4m18bdc2cc842b933e@mail.gmail.com","subject":"Re: How can i find the origin of a branch?","fromName":"Dotan Barak","fromEmail":"dotanba@gmail.com","sentAt":"2009-06-15T13:34:30Z","receivedAt":"2009-06-15T13:34:30Z","isPatch":false,"sender":{"key":"dotanba@gmail.com","avatar":null},"body":"Thanks, your suggestion helped, but there is one problem:\n\nI noticed that if there is only one branch, the entry\nbranch.<branch_name>.merge doesn't exist.\nEven if there is more than one remote URLs.\n\n\nDotan\n\nOn Mon, Jun 15, 2009 at 3:03 PM, Dotan Barak<dotanba@gmail.com> wrote:\n> Thank you very much for a quick and exact answer\n> :)\n>\n> Dotan\n>\n>\n> On Mon, Jun 15, 2009 at 2:57 PM, Kristian Amlie<kristian.amlie@nokia.com> wrote:\n>> ext Dotan Barak wrote:\n>>> Hi.\n>>>\n>>> Is it possible to find the origin of a branch?\n>>> (the remote repository that this branch was cloned and checked out from)\n>>\n>> git config -l\n>>\n>> Assuming you're on the master branch, branch.master.remote and\n>> branch.master.merge will tell you which remote and which branch you are\n>> tracking. Assuming that the remote is origin, you can check\n>> remote.origin.url to see the URL of the repo.\n>>\n>> --\n>> Kristian\n>>\n>\n"}]}