Hi! I'm Nathan Hoad


Git: View a file in another branch

If you're in one branch but need to quickly peek at a file in another branch (without checking it out) you can do this:

git show branch:file

So if you're in a branch called new-thing but need to look at a file like app/controllers/something_controller.rb in other-branch then you can do this:

git show other-branch:app/controllers/something_controller.rb

And that will show the contents without having to checkout other-branch.

If I just made your day a little better then thank me with a coffee or maybe a a pizza