Reverting to a previous version of a file using git

View list of versions for a file:

git log main.m

This will display a list of commits for that file:

commit d689ccce47c51a478550609db124afe2940a0a21
Author: Martyn Davis <mad@madlid.com>
Date:   Mon Oct 5 14:02:56 2015 +1100
    Some changes
commit 9f0c61426043e3323365e89b2b1a08c3282cce6b
Author: Martyn Davis <mad@madlid.com>
Date:   Mon Oct 5 07:47:41 2015 +1100
    First working version

To revert back to the first commit of main.m:

git checkout 9f0c61426043e3323365e89b2b1a08c3282cce6b main.m