Converted git checkout to using git diff and git show instead, for performance.