如何查看本地分支和远程分支在指定文件中的差异? [英] how can I see the differences in a designated file between a local branch and a remote branch?

查看:563
本文介绍了如何查看本地分支和远程分支在指定文件中的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查看本地分支和远程分支在指定文件中的差异?

How can I see the differences in a designated file between a local branch and a remote branch?

我知道以下命令:

git diff <local branch> <remote-tracking branch>

但是它给出了两个分支之间所有文件的差异,而我只关心单个指定文件的更改.

But it gives the differences in all files between two branches while I only care about changes of one single designated file.

推荐答案

看看git diff --help,它向您显示:

git diff [options] <commit> <commit> [--] [<path>...]

所以,您快到了.代替:

So, you're almost there. Instead of:

git diff <local branch> <remote-tracking branch>

您可以使用:

git diff <local branch> <remote-tracking branch> path/to/file

这篇关于如何查看本地分支和远程分支在指定文件中的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆