git show a file at a specific commit

# Print the file contents at a specific commit
git show abc1234:src/app.ts

# Restore a file from a past commit into your working directory
git checkout abc1234 -- src/app.ts

You want to inspect or recover a file as it looked at a past commit — without switching branches.

Save the old version to a different filename

git show abc1234:src/app.ts > src/app.old.ts

Show a file from a tag or branch

git show v1.2.0:src/app.ts
git show main:src/app.ts

See all files changed in a commit

git show --name-only abc1234