git shell

Retrieving File Contents of a Specified Commit Using git show

When using git or github in programming, there are cases where you want to see or retrieve the contents of a file from a specific commit using "git show".

Shou Arisaka
1 min read
Oct 10, 2025

When using git or github in programming, there are cases where you want to see or retrieve the contents of a file from a specific commit using “git show”.

The following format is possible:

# git show:[file]
git show 091fd67:mnt/c/time_management/time_management.txt

If you want to compare the contents of the current file with a file from a specific commit, you can do the following. meld can also be replaced with diff etc.

meld <( git show 60a6b5b:mnt/c/time_management/time_management.txt  ) <( cat mnt/c/time_management/time_management.txt  )

If you want to compare the contents of a file from a specific commit with a file from another specific commit, you can do the following:

meld <( git show 091fd67:mnt/c/time_management/time_management.txt  ) <( git show d924ed5:mnt/c/time_management/time_management.txt  )

Share this article

Shou Arisaka Oct 10, 2025

🔗 Copy Links