Only rewrite selected commits
Prevent multiple enumeration of commitsToRewrite
only generates a Tree when it's been rewritten