Baking cookies
Gradient background

How to recover a file from another branch in Git

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Tuesday, 25 January 2022 · Estimated 1 minute read
Copy
git show branch:filename.ext > path/to/file.ext

Where branch can be any ref including a branch name, tag, HEAD.

Thanks to this Stack Overflow reference.