threads / discuss / 22886

Identifying the branch a clone was cloned from

Subject: Identifying the branch a clone was cloned from

## tl;dr

2 messages between Mar 2, 2010 and Mar 2, 2010.

replies: 1people: 2as markdown or json

jateeq· Mar 2, 2010, 21:45 UTC · lore
Hey guys,

I have a repository with over 10 branches. I clone from branch 2, and some time after the operation I need to find out what branch in the remote I cloned from. Anyone know the command for that?

Thank you, Jawad.

-- 
View this message in context: http://old.nabble.com/Identifying-the-branch-a-clone-was-cloned-from-tp27761617p27761617.html
Sent from the git mailing list archive at Nabble.com.
Santi Béjar· Mar 2, 2010, 23:15 UTC · re: jateeq · lore

Re: Identifying the branch a clone was cloned from

On Tue, Mar 2, 2010 at 10:45 PM, jateeq <jawad_atiq@hotmail.com> wrote:
Show 6 quoted lines
>
> Hey guys,
>
> I have a repository with over 10 branches. I clone from branch 2, and some
> time after the operation I need to find out what branch in the remote I
> cloned from. Anyone know the command for that?

If you mean from which branch you forked a given branch it is specified in the branch.<name>.remote and branch.<name>.merge + some logic. To get it you can use the branchname@{upstream} syntax (new in 1.7.0) or use this command:

git for-each-ref --format='%(upstream)' refs/heads/branchname

But maybe we can help more if you say what you want to accomplish with this information and not this specific detail.

HTH, Santi

← back to recent threads