Git: Retrieve a file from a different branch or commit

Posted . Visible to the public.

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
Tobias Kraze
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2012-02-11 00:02)