Explore Courses Blog Tutorials Interview Questions
0 votes
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!

30.5k questions

32.6k answers


108k users

Browse Categories