Git责怪忽略了特定的提交 [英] Git blame ignoring specific commit

查看:83
本文介绍了Git责怪忽略了特定的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git blame命令来查看在其中添加了某些特定代码行的提交,但是有时我遇到相同的问题:有人进行了某种代码格式化,或者更改了功能接口并刷新了所有客户端代码.

最终git blame仅向我显示特定代码行上的最后一次提交.如何忽略此提交并查看之前发生了什么?

我当然可以在进行格式编辑的提交之前检出提交并再次指责,但是在大型项目上可能要花费很多时间,而且不合适.

解决方案

我认为您正在寻找不包含空格的-w选项.根据手册页.

在比较父母的版本和孩子的版本以查找行的来源时,请忽略空格.

移动的代码也可以排除.请参阅-M和-C选项.参见 https://git-scm.com/docs/git-blame

I use git blame command to see in which commit have been added some particular code line, but sometimes I bump into the same problem: someone has made some kind of code formatting, or has changed function interface and refreshed all client code.

Eventually git blame show me only this last commit on particular code line. How ignore this commit and see what happened before it?

Of course I can checkout on commit before format-edited commit and see blame again, but it may take a lot of time on huge project and doesn't appropriate.

解决方案

I think you are looking for the -w option that excludes white space. According to the man page.

Ignore whitespace when comparing the parent’s version and the child’s to find where the lines came from.

Moved code can also be excluded. See the -M and -C options. See https://git-scm.com/docs/git-blame

这篇关于Git责怪忽略了特定的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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