Getting contents of a file in a specific commit in Git

Use below command to show contents of a file in a specific commit:

# Get contents of a file in a specific commit.
# <commit>, specify the commit, such as an commit id.
# <file-path>, file path of relative to the current directory.
$ git show <commit>:<file-path>

Examples:

# Get contents of asset/css/style.css in commit 8bc723c
$ git show 8bc723c:asset/css/style.css

# Get contents of asset/css/style.css in the parent commit.
$ git show HEAD~:asset/css/style.css