git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* newb: Given a commit id, find which branches have it as an ancestor
@ 2009-03-12 15:21 Kelly F. Hickel
  2009-03-12 15:38 ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Kelly F. Hickel @ 2009-03-12 15:21 UTC (permalink / raw)
  To: git; +Cc: Kelly F. Hickel

Hi all, I've been working on testing importing our cvs repo via cvs2git,
then using cvsps to pull incremental updates.  Something seems to have
gone awry with one of the commits, and I'm having trouble tracking it
down.

This is a question about how to track something down after the fact, not
a question about what went wrong with the cvsps import....

This is git 1.6.1 running on Centos 5.2 linux.

So, the scenario is that one of the last few commits pulled into my git
repo by cvsps/cvsimport should have landed on origin/master, but when I
look at the file, the change is missing.  I'm trying to figure out
"where it went", since it didn't go where I expected it.

Things I've tried that didn't tell me what I wanted to know:
$ git name-rev 15fa81b
15fa81b undefined


$ git log --children 15fa81b
This shows me a bunch of commits that, going by the commit date, appear
to be ancestors of the commit I'm interested in, not children.

$ git checkout  15fa81b5ae
Note: moving to "15fa81b5ae" which isn't a local branch If you want to
create a new branch from this checkout, you may do so (now or later) by
using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at 15fa81b... Changed version to 4.1.0.157 $ gitk (as
expected, shows me that the commit I care about is the latest in the
workspace)

$ git checkout master
Previous HEAD position was 15fa81b... Changed version to 4.1.0.157
Switched to branch "master"
$ gitk
Doesn't list my target commit, in fact, doesn't list any commits after
the cvs2git date, so it appears that none of my cvsps pulled commits
landed on master (ok, so maybe this post is about what went wrong, just
a little ;-} ).

I suspect that I'm missing some factoid in trying to map my workflow to
Git, but this seems like the kind of thing I'd want to know, i.e. given
a commit, what branches have that commit as an ancestor.  It would seem
to be useful in two cases:
1) I've found a commit that introduced a bug and want to know what
releases that bug ended up in.
2) I've identified a fix for a previous bug and want to know what
releases already contain the fix.
(ok, those are pretty much the same workflow, but different reasons).

What am I missing????



--

Kelly F. Hickel
Senior Product Architect
MQSoftware, Inc.
952-345-8677 Office
952-345-8721 Fax
kfh@mqsoftware.com
www.mqsoftware.com
Certified IBM SOA Specialty
Your Full Service Provider for IBM WebSphere
Learn more at www.mqsoftware.com 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: newb: Given a commit id, find which branches have it as an ancestor
  2009-03-12 15:21 newb: Given a commit id, find which branches have it as an ancestor Kelly F. Hickel
@ 2009-03-12 15:38 ` Johannes Sixt
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Sixt @ 2009-03-12 15:38 UTC (permalink / raw)
  To: Kelly F. Hickel; +Cc: git

$ git branch -a --contains the-sha1

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: newb: Given a commit id, find which branches have it as an ancestor
       [not found] <63BEA5E623E09F4D92233FB12A9F794302E0F9B2@emailmn.mqsoftware.com>
@ 2009-03-12 19:38 ` Kelly F. Hickel
  2009-03-13  7:14   ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Kelly F. Hickel @ 2009-03-12 19:38 UTC (permalink / raw)
  To: j.sixt; +Cc: git

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: newb: Given a commit id, find which branches have it as an ancestor
  2009-03-12 19:38 ` Kelly F. Hickel
@ 2009-03-13  7:14   ` Johannes Sixt
  2009-03-13  7:37     ` Junio C Hamano
  2009-03-13 13:30     ` Kelly F. Hickel
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Sixt @ 2009-03-13  7:14 UTC (permalink / raw)
  To: Kelly F. Hickel; +Cc: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: newb: Given a commit id, find which branches have it as an ancestor
  2009-03-13  7:14   ` Johannes Sixt
@ 2009-03-13  7:37     ` Junio C Hamano
  2009-03-13 13:31       ` Kelly F. Hickel
  2009-03-13 13:30     ` Kelly F. Hickel
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-03-13  7:37 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Kelly F. Hickel, git

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: newb: Given a commit id, find which branches have it as an ancestor
  2009-03-13  7:14   ` Johannes Sixt
  2009-03-13  7:37     ` Junio C Hamano
@ 2009-03-13 13:30     ` Kelly F. Hickel
  1 sibling, 0 replies; 8+ messages in thread
From: Kelly F. Hickel @ 2009-03-13 13:30 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

> -----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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: newb: Given a commit id, find which branches have it as an ancestor
  2009-03-13  7:37     ` Junio C Hamano
@ 2009-03-13 13:31       ` Kelly F. Hickel
  0 siblings, 0 replies; 8+ messages in thread
From: Kelly F. Hickel @ 2009-03-13 13:31 UTC (permalink / raw)
  To: Junio C Hamano, Johannes Sixt; +Cc: git

> -----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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: newb: Given a commit id, find which branches have it as an ancestor
@ 2009-03-13 16:20 John Dlugosz
  0 siblings, 0 replies; 8+ messages in thread
From: John Dlugosz @ 2009-03-13 16:20 UTC (permalink / raw)
  To: git

=== Re: ===
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.
=== end===

Both gitk (comes with git) and QGit showthe branches on the GUI when you highlight the commit of interest.

As for recovering lost commits, I've been down that road, and using fsck or worse yet looking at all the files in the objects directory is no fun.  The 'reflog' is your friend!  Use reflog to spot which one is interesting, and then use something like
                git tag here HEAD@{5}
and then bring up gitk with "all branches" and sort it out.

--John
(please excuse the footer; it's not my idea)

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-13 16:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-12 15:21 newb: Given a commit id, find which branches have it as an ancestor Kelly F. Hickel
2009-03-12 15:38 ` Johannes Sixt
     [not found] <63BEA5E623E09F4D92233FB12A9F794302E0F9B2@emailmn.mqsoftware.com>
2009-03-12 19:38 ` Kelly F. Hickel
2009-03-13  7:14   ` Johannes Sixt
2009-03-13  7:37     ` Junio C Hamano
2009-03-13 13:31       ` Kelly F. Hickel
2009-03-13 13:30     ` Kelly F. Hickel
  -- strict thread matches above, loose matches on Subject: below --
2009-03-13 16:20 John Dlugosz

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).