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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should work:
Where branch can be any ref (branch, tag, HEAD, …) and file is the full path of the file. To export it you could use
You should also look at VonC‘s answers to some related questions:
UPDATE 2015-01-19:
Nowadays you can use relative paths with
git show a1b35:./file.txt.