Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)
Is it possible to open a file in a git branch without checking out that branch? How?

Essentially I want to be able to open a file in my GitHub pages branch without switching branches all the time. I don't want to modify it, just want to view it.

1 Answer

0 votes
by (27.5k points)

The following command will do

$ git show branch:file

Here, branch can be any ref (branch, tag, HEAD, ...) and file is the full path of the file. In order to export it you could use

$ git show branch:file > exported_file

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.2k users

Browse Categories

...