git-diff中是否有类似于diff --show-c-function的东西? [英] Is there something similar to diff --show-c-function in git-diff?

查看:130
本文介绍了git-diff中是否有类似于diff --show-c-function的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在处理git存储库中的文件。如果我有该文件的原始git版本的副本,则可以运行diff --show-c-function来比较这两个文件,其中(理论上)该文件显示了已被删除的所有函数的全部内容。改变了。这对于确定我对文件所做的特定操作以及确定所需的注释非常有用。

I've been working on a file in my git repository. If I have a copy of the original git version of the file, I can run diff --show-c-function to get a comparison of the 2, files, where (in theory) it shows the whole of any function which has been changed. This is really useful for working out what I did specifically to a file, in working out the comment I'd need.

但是在git-diff中,缺少此选项。有什么方法可以完成这项工作(或者我是否必须在提交前必须获得2个文件副本,否则git-diff响应会有些复杂)?

However in git-diff, this option is missing. Is there some way to make this work (or am I stuck having to get 2 copies of the file before I can commit, where the git-diff response is slightly complicated)?

推荐答案

git help diff 显示此选项:

-W, --function-context
        Show whole surrounding functions of changes.

因此,它看起来像 git diff -W 应该随心所欲。

So, it looks like git diff -W should do what you want.

这篇关于git-diff中是否有类似于diff --show-c-function的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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