开发者

How to compare a file on 2 different git remotes

开发者 https://www.devze.com 2023-02-02 18:15 出处:网络
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 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
0

精彩评论

暂无评论...
验证码 换一张
取 消