git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How do I quickly check what heads a particular commit is in?
@ 2006-04-24  4:23 Martin Langhoff
  2006-04-24  4:40 ` Junio C Hamano
  2006-04-24  4:41 ` Jeff King
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Langhoff @ 2006-04-24  4:23 UTC (permalink / raw)
  To: Git Mailing List

In the middle of a merge of 2 of a bunch of closely related heads, I
found a few odd things, so I've pickaxe'd and found the (potentially
bogus) commits. I am using gitk, and while I do find the commit, it's
not very clear what heads have the dodgy commit. They've probably been
for a few months in there <sigh>.

Is there a practical way to ask in what heads they are?



martin

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

* Re: How do I quickly check what heads a particular commit is in?
  2006-04-24  4:23 How do I quickly check what heads a particular commit is in? Martin Langhoff
@ 2006-04-24  4:40 ` Junio C Hamano
  2006-04-24  4:50   ` Martin Langhoff
  2006-04-24  4:41 ` Jeff King
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-04-24  4:40 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: git

"Martin Langhoff" <martin.langhoff@gmail.com> writes:

> In the middle of a merge of 2 of a bunch of closely related heads, I
> found a few odd things, so I've pickaxe'd and found the (potentially
> bogus) commits. I am using gitk, and while I do find the commit, it's
> not very clear what heads have the dodgy commit. They've probably been
> for a few months in there <sigh>.
>
> Is there a practical way to ask in what heads they are?

git merge-base $broken_commit "master"

would show $broken_commit if "master" is a fast-forward of
$broken_commit (i.e. "master" is a descendant).  I think that is
what you are calling "$broken_commit is in master".

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

* Re: How do I quickly check what heads a particular commit is in?
  2006-04-24  4:23 How do I quickly check what heads a particular commit is in? Martin Langhoff
  2006-04-24  4:40 ` Junio C Hamano
@ 2006-04-24  4:41 ` Jeff King
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff King @ 2006-04-24  4:41 UTC (permalink / raw)
  To: Git Mailing List

On Mon, Apr 24, 2006 at 04:23:24PM +1200, Martin Langhoff wrote:

> Is there a practical way to ask in what heads they are?

This should work:

$ cat <<'EOF' >find-commit
#!/bin/sh
commit=$1; shift
for i in "$@"; do
  git rev-list $i | fgrep -q $commit && echo $i
done
EOF
$ sh find-commit full-40char-sha1-of-commit head1 head2 ...

You potentially end up traversing parts of the history multiple times
(if they are shared by multiple heads) but git is fast enough that
performance is fine.

I don't know of a way to do it all in a git command without the fgrep.

-Peff

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

* Re: How do I quickly check what heads a particular commit is in?
  2006-04-24  4:40 ` Junio C Hamano
@ 2006-04-24  4:50   ` Martin Langhoff
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Langhoff @ 2006-04-24  4:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 4/24/06, Junio C Hamano <junkio@cox.net> wrote:
> git merge-base $broken_commit "master"
>
> would show $broken_commit if "master" is a fast-forward of
> $broken_commit (i.e. "master" is a descendant).  I think that is
> what you are calling "$broken_commit is in master".

of course! Thanks! I'm in the middle of a somewhat nasty merge, and my
fingers got all tangled working up and down the history finding what
heads have this commit. I can now do a loop with bash calling all the
heads against it. Great!

 (hmmm. just had to decide to go back to basics and perform some
reverts before retrying the merge.)


m

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

end of thread, other threads:[~2006-04-24  4:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-24  4:23 How do I quickly check what heads a particular commit is in? Martin Langhoff
2006-04-24  4:40 ` Junio C Hamano
2006-04-24  4:50   ` Martin Langhoff
2006-04-24  4:41 ` Jeff King

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