Git: Retrieve a file from a different branch or commit
To access files from another branch or past commit without doing a complete checkout, you can either use
git show branch:file
git show commit:file
to display, or check out the file into your working directory with
git checkout branch -- file
git checkout commit -- file