"Thomas Harning Jr." <harningt@xxxxxxxxx> writes: > I'm working on my 'Stick' git bug-tracking tool and am working on the > functionality to get a list of relevant bug-items at a specific point > in history. > > Before I get into figuring out the 'best' way to do this, I thought > I'd at least get the simple single-item case of detecting if a > specific commit can be walked to from another commit... It is unclear from your description what you are trying to do here, but if you want to know if a commit A is reachable from commit B, the standard way to do so is: git merge-base A B If the output from the command is the object name of commit A, that means A is reachable from B. Otherwise A is not reachable from B. This is because "merge-base" computes the set of ancestors common to A and B that are not reachable from other ancestors common to A and B. Examples. (1) This one is obvious. A---o---o---o---B (2) Merge-base between A and B is M. The one before M is also an ancestor common to A and B, but because it is reachable from M which is another ancestor common between A and B, it won't be part of the merge-base output. o---A / o---M---o---B If you have bunch of commits A B C D E F and if you would want to know which one of them is reachable from X, you could of course run merge-base once for each of A..F. Another way to do this would be to run: git rev-list A B C D E F ^X and look at the output. The ones among A..F that appear in the output are not reachable from X. The ones that are reachable from X do not appear in the output. This is because "rev-list" outputs everything reachable from the given commits without ^ prefix, excluding the ones that are reacahble from the ones prefixed with ^. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html