Removing merges from the commit history should give more relevant results for a given depth. Grit allows native git commands, so this can be done by just passing options to rev-list and then parsing the list of commits.