Listing and Showing Files
git ls-files lists tracked files. git show REV:path prints a file as it was in a commit, without checking it out.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt && git commit -qam 'Second'
git ls-files
git show HEAD~1:a.txt
git show HEAD:a.txtResult
a.txt one one two
Exercise
Print a file from the last commit.
git show HEADa.txt
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.