You have another epiphany.
By looking at your code history as a tree, solving the problem of ancestry becomes trivial.