[Git] Show the contents of a file on another branch

Created on November 30, 2026

Pass branch:path to git show. This example reads src/config.js from the feature/add-login branch. Both the branch reference and the named path must exist in the repository.

git show feature/add-login:src/config.js

The command prints the contents to standard output and leaves the current branch and working tree as they were.

Git