* How can i find the origin of a branch?
@ 2009-06-15 11:37 Dotan Barak
2009-06-15 11:57 ` Kristian Amlie
2009-06-15 12:07 ` Alex Riesen
0 siblings, 2 replies; 7+ messages in thread
From: Dotan Barak @ 2009-06-15 11:37 UTC (permalink / raw)
To: git
Hi.
Is it possible to find the origin of a branch?
(the remote repository that this branch was cloned and checked out from)
Thanks
Dotan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 11:37 How can i find the origin of a branch? Dotan Barak
@ 2009-06-15 11:57 ` Kristian Amlie
2009-06-15 12:03 ` Dotan Barak
2009-06-15 12:48 ` Alex Riesen
2009-06-15 12:07 ` Alex Riesen
1 sibling, 2 replies; 7+ messages in thread
From: Kristian Amlie @ 2009-06-15 11:57 UTC (permalink / raw)
To: Dotan Barak; +Cc: git@vger.kernel.org
ext Dotan Barak wrote:
> Hi.
>
> Is it possible to find the origin of a branch?
> (the remote repository that this branch was cloned and checked out from)
git config -l
Assuming you're on the master branch, branch.master.remote and
branch.master.merge will tell you which remote and which branch you are
tracking. Assuming that the remote is origin, you can check
remote.origin.url to see the URL of the repo.
--
Kristian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 11:57 ` Kristian Amlie
@ 2009-06-15 12:03 ` Dotan Barak
2009-06-15 13:34 ` Dotan Barak
2009-06-15 12:48 ` Alex Riesen
1 sibling, 1 reply; 7+ messages in thread
From: Dotan Barak @ 2009-06-15 12:03 UTC (permalink / raw)
To: Kristian Amlie; +Cc: git@vger.kernel.org
Thank you very much for a quick and exact answer
:)
Dotan
On Mon, Jun 15, 2009 at 2:57 PM, Kristian Amlie<kristian.amlie@nokia.com> wrote:
> ext Dotan Barak wrote:
>> Hi.
>>
>> Is it possible to find the origin of a branch?
>> (the remote repository that this branch was cloned and checked out from)
>
> git config -l
>
> Assuming you're on the master branch, branch.master.remote and
> branch.master.merge will tell you which remote and which branch you are
> tracking. Assuming that the remote is origin, you can check
> remote.origin.url to see the URL of the repo.
>
> --
> Kristian
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 12:03 ` Dotan Barak
@ 2009-06-15 13:34 ` Dotan Barak
0 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2009-06-15 13:34 UTC (permalink / raw)
To: Kristian Amlie; +Cc: git@vger.kernel.org
Thanks, your suggestion helped, but there is one problem:
I noticed that if there is only one branch, the entry
branch.<branch_name>.merge doesn't exist.
Even if there is more than one remote URLs.
Dotan
On Mon, Jun 15, 2009 at 3:03 PM, Dotan Barak<dotanba@gmail.com> wrote:
> Thank you very much for a quick and exact answer
> :)
>
> Dotan
>
>
> On Mon, Jun 15, 2009 at 2:57 PM, Kristian Amlie<kristian.amlie@nokia.com> wrote:
>> ext Dotan Barak wrote:
>>> Hi.
>>>
>>> Is it possible to find the origin of a branch?
>>> (the remote repository that this branch was cloned and checked out from)
>>
>> git config -l
>>
>> Assuming you're on the master branch, branch.master.remote and
>> branch.master.merge will tell you which remote and which branch you are
>> tracking. Assuming that the remote is origin, you can check
>> remote.origin.url to see the URL of the repo.
>>
>> --
>> Kristian
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 11:57 ` Kristian Amlie
2009-06-15 12:03 ` Dotan Barak
@ 2009-06-15 12:48 ` Alex Riesen
2009-06-15 13:10 ` Kristian Amlie
1 sibling, 1 reply; 7+ messages in thread
From: Alex Riesen @ 2009-06-15 12:48 UTC (permalink / raw)
To: Kristian Amlie; +Cc: Dotan Barak, git@vger.kernel.org
2009/6/15 Kristian Amlie <kristian.amlie@nokia.com>:
> ext Dotan Barak wrote:
>>
>> Is it possible to find the origin of a branch?
>> (the remote repository that this branch was cloned and checked out from)
>
> git config -l
>
> Assuming you're on the master branch, branch.master.remote and
> branch.master.merge will tell you which remote and which branch you are
> tracking. Assuming that the remote is origin, you can check
> remote.origin.url to see the URL of the repo.
Except when it is just happen to have the same name.
IOW, it is a BIG oversimplification.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 12:48 ` Alex Riesen
@ 2009-06-15 13:10 ` Kristian Amlie
0 siblings, 0 replies; 7+ messages in thread
From: Kristian Amlie @ 2009-06-15 13:10 UTC (permalink / raw)
To: ext Alex Riesen; +Cc: Dotan Barak, git@vger.kernel.org
ext Alex Riesen wrote:
> 2009/6/15 Kristian Amlie <kristian.amlie@nokia.com>:
>> ext Dotan Barak wrote:
>>> Is it possible to find the origin of a branch?
>>> (the remote repository that this branch was cloned and checked out from)
>> git config -l
>>
>> Assuming you're on the master branch, branch.master.remote and
>> branch.master.merge will tell you which remote and which branch you are
>> tracking. Assuming that the remote is origin, you can check
>> remote.origin.url to see the URL of the repo.
>
> Except when it is just happen to have the same name.
> IOW, it is a BIG oversimplification.
Probably, but why make the simple case overcomplicated? It should give
you the answer in 90% of the cases.
--
Kristian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How can i find the origin of a branch?
2009-06-15 11:37 How can i find the origin of a branch? Dotan Barak
2009-06-15 11:57 ` Kristian Amlie
@ 2009-06-15 12:07 ` Alex Riesen
1 sibling, 0 replies; 7+ messages in thread
From: Alex Riesen @ 2009-06-15 12:07 UTC (permalink / raw)
To: Dotan Barak; +Cc: git
2009/6/15 Dotan Barak <dotanba@gmail.com>:
> Is it possible to find the origin of a branch?
> (the remote repository that this branch was cloned and checked out from)
Look for a repository which has the smallest count of commits
in common with the branch.
You can use git merge-base to find all the commits which could
possible be the point of divergence (aka "merge base"). Then
you can find all the remote branches which have the "merge bases"
(git branch --contains <base>). Any of that remote branches
could have been the origin of your local branch.
You'll seldom (if ever again) need that, I think.
P.S. You don't clone branches. Not as such. You clone repositories,
which have the commits, which a branch (as in "reference") can point to.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-15 13:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 11:37 How can i find the origin of a branch? Dotan Barak
2009-06-15 11:57 ` Kristian Amlie
2009-06-15 12:03 ` Dotan Barak
2009-06-15 13:34 ` Dotan Barak
2009-06-15 12:48 ` Alex Riesen
2009-06-15 13:10 ` Kristian Amlie
2009-06-15 12:07 ` Alex Riesen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).