Fix a bug in diff. Fixes checkout issue.
Added comments.
Merge pull request #2609 from dart-lang/fix_git_checkout

[Hot Fix] Fix a bug in diff. Fixes checkout issue.