Display a file from another branch

twitter logo github logo ・1 min read

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

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>

Enjoy!

twitter logo DISCUSS
Classic DEV Post from Oct 31 '18

📊 Languages' Popularity on DEV

Some statistics about language tags on DEV

Mathieu PATUREL profile image
Don't have much inspiration for an original bio right now...

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️