# RE: newb: Given a commit id, find which branches have it as an ancestor

5 messages from 2009-03-12 to 2009-03-13. Participants: Kelly F. Hickel, Johannes Sixt, Junio C Hamano.
Thread: https://gitlist.dev/t/18291

## Kelly F. Hickel, 2009-03-12 19:38

Subject: RE: newb: Given a commit id, find which branches have it as an ancestor
Message-ID: <63BEA5E623E09F4D92233FB12A9F794302E0F9BA@emailmn.mqsoftware.com>
URL: https://gitlist.dev/e/63BEA5E623E09F4D92233FB12A9F794302E0F9BA%40emailmn.mqsoftware.com
In-Reply-To: <63BEA5E623E09F4D92233FB12A9F794302E0F9B2@emailmn.mqsoftware.com>

```
> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Johannes Sixt
> Sent: Thursday, March 12, 2009 10:38 AM
> To: Kelly F. Hickel

> $ git branch -a --contains the-sha1
> 
> -- Hannes
> 

Thanks, that looks like a really useful command.

Unfortunately, in this case it didn't print anything out (neither did
"git branch -r -a sha1").

What I'm beginning to suspect is that all the commits that should have
gone to master went to some unnamed branch.
Is that reasonable/possible/likely?  This commit has a full ancestry,
but doesn't appear to be on any branch.

In the above question there's an assumption that if a branch exists
without a name, then git branch -a --contains wouldn't print anything
out, is that correct?

Thanks,
Kelly

```

## Johannes Sixt, 2009-03-13 07:14

Subject: Re: newb: Given a commit id, find which branches have it as an ancestor
Message-ID: <49BA07E5.2080701@viscovery.net>
URL: https://gitlist.dev/e/49BA07E5.2080701%40viscovery.net
In-Reply-To: <63BEA5E623E09F4D92233FB12A9F794302E0F9BA@emailmn.mqsoftware.com>

```
Kelly F. Hickel schrieb:
>> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
>> Behalf Of Johannes Sixt
>> Sent: Thursday, March 12, 2009 10:38 AM
>> To: Kelly F. Hickel
> 
>> $ git branch -a --contains the-sha1
>>
>> -- Hannes
>>
> 
> Thanks, that looks like a really useful command.
> 
> Unfortunately, in this case it didn't print anything out (neither did
> "git branch -r -a sha1").
> 
> What I'm beginning to suspect is that all the commits that should have
> gone to master went to some unnamed branch.
> Is that reasonable/possible/likely?  This commit has a full ancestry,
> but doesn't appear to be on any branch.
> 
> In the above question there's an assumption that if a branch exists
> without a name, then git branch -a --contains wouldn't print anything
> out, is that correct?

Correct.

Your best bet is perhaps that you create a branch at the commit

  $ git branch tmp-branch your_sha1

so that the commits are not lost, then you cherry-pick them to master.

-- Hannes

```

## Junio C Hamano, 2009-03-13 07:37

Subject: Re: newb: Given a commit id, find which branches have it as an ancestor
Message-ID: <7v3adhj2ku.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v3adhj2ku.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <49BA07E5.2080701@viscovery.net>

```
Johannes Sixt <j.sixt@viscovery.net> writes:

> Your best bet is perhaps that you create a branch at the commit
>
>   $ git branch tmp-branch your_sha1
>
> so that the commits are not lost, then you cherry-pick them to master.

It could be that there are more commits that are built on top of the one
you are aware of.  Finding unreachable commits from "git fsck --full"
might help you find them.

```

## Kelly F. Hickel, 2009-03-13 13:30

Subject: RE: newb: Given a commit id, find which branches have it as an ancestor
Message-ID: <63BEA5E623E09F4D92233FB12A9F794302E0F9D8@emailmn.mqsoftware.com>
URL: https://gitlist.dev/e/63BEA5E623E09F4D92233FB12A9F794302E0F9D8%40emailmn.mqsoftware.com
In-Reply-To: <49BA07E5.2080701@viscovery.net>

```
> -----Original Message-----
> From: Johannes Sixt [mailto:j.sixt@viscovery.net]
> Sent: Friday, March 13, 2009 2:15 AM
> To: Kelly F. Hickel
> Cc: git@vger.kernel.org
> Subject: Re: newb: Given a commit id, find which branches have it as
an
> ancestor
> 
> Kelly F. Hickel schrieb:
> >> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org]
> On
> >> Behalf Of Johannes Sixt
> >> Sent: Thursday, March 12, 2009 10:38 AM
> >> To: Kelly F. Hickel
> >
> >> $ git branch -a --contains the-sha1
> >>
> >> -- Hannes
> >>
> >
> > Thanks, that looks like a really useful command.
> >
> > Unfortunately, in this case it didn't print anything out (neither
did
> > "git branch -r -a sha1").
> >
> > What I'm beginning to suspect is that all the commits that should
> have
> > gone to master went to some unnamed branch.
> > Is that reasonable/possible/likely?  This commit has a full
ancestry,
> > but doesn't appear to be on any branch.
> >
> > In the above question there's an assumption that if a branch exists
> > without a name, then git branch -a --contains wouldn't print
anything
> > out, is that correct?
> 
> Correct.
> 
> Your best bet is perhaps that you create a branch at the commit
> 
>   $ git branch tmp-branch your_sha1
> 
> so that the commits are not lost, then you cherry-pick them to master.
> 
> -- Hannes

Thanks, in the end it turned out that I just hadn't properly understood
the 
Comment about doing your own merge in the git-cvsimport doc.  For
whatever
reason, when doing cvsimport in a workspace on master, after the import
I 
have to do "git merge origin/master" and it fast forwards it and all is
well.
I *don't* have to do that for any of the other branches that get
affected by
the cvsimport, so that threw me for awhile.

Thanks for the help,
Kelly

```

## Kelly F. Hickel, 2009-03-13 13:31

Subject: RE: newb: Given a commit id, find which branches have it as an ancestor
Message-ID: <63BEA5E623E09F4D92233FB12A9F794302E0F9D9@emailmn.mqsoftware.com>
URL: https://gitlist.dev/e/63BEA5E623E09F4D92233FB12A9F794302E0F9D9%40emailmn.mqsoftware.com
In-Reply-To: <7v3adhj2ku.fsf@gitster.siamese.dyndns.org>

```
> -----Original Message-----
> From: Junio C Hamano [mailto:gitster@pobox.com]
> Sent: Friday, March 13, 2009 2:37 AM
> To: Johannes Sixt
> Cc: Kelly F. Hickel; git@vger.kernel.org
> Subject: Re: newb: Given a commit id, find which branches have it as
an
> ancestor
> 
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
> > Your best bet is perhaps that you create a branch at the commit
> >
> >   $ git branch tmp-branch your_sha1
> >
> > so that the commits are not lost, then you cherry-pick them to
> master.
> 
> It could be that there are more commits that are built on top of the
> one
> you are aware of.  Finding unreachable commits from "git fsck --full"
> might help you find them.

Thanks, turned out to be my misunderstanding of how to do incremental
imports
(see my response to Johannes).

Thanks for the help,
-Kelly

```
