checkout commit git code example Example 1: how to check git changes before commit git diff --staged Example 2: git checkout commit git checkout <commit>