DEV Community ðŸ‘Đ‍ðŸ’ŧðŸ‘Ļ‍ðŸ’ŧ

DEV Community ðŸ‘Đ‍ðŸ’ŧðŸ‘Ļ‍ðŸ’ŧ is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Mathieu PATUREL
Mathieu PATUREL

Posted on

Display a file from another branch

Ever wanted to see a file from a different branch? Well, no need to stash && checkout, just use git show.

dev $ git show master:path/to/file
Enter fullscreen mode Exit fullscreen mode

PS: this works with any reference (not sure if that's the right term, correct me if I'm wrong), like commit and tags:

master $ git log --oneline
d529def Some more new stuff
4598db3 Some new stuff
e8dd680 init
master $ git show e8dd680:path/to/file
<The content of the file at commit e8dd680>
Enter fullscreen mode Exit fullscreen mode

Enjoy!

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.