How to compare a file on 2 different git remotes
I want to compare a file (main_co开发者_开发技巧ntroller.rb) on 2 different remotes (namely, production and staging) since I got different behavior on production and staging.
I believe the code (i.e. the file) is the same, but just wanted to be sure. But I can't figure out how to do this comparison in git.
Any help would be appreciated.
Do you have both remotes set up in the same repo? I'll assume you do, and that they're called production
and staging
. There is a way to refer to a file in a specific commit/tree, and the syntax is treeish:path/to/file
. You should be able to use this with git diff
to say something like
git diff production:path/to/file staging:path/to/file
精彩评论