git查看函数修改历史

强烈推荐 Github: git-flight-rules


追踪一个函数的变更历史可以使用 I want to view the commit history for a specific function

git log -L :FunctionName:FilePath

谢谢weixin_43412244的评论,进行一下拓展,
如果想查看特定区间内函数的修改历史,请参考我在SO的问题git show modification of a function between two commits
如果想查看某个同名函数(overloading)的历史,请参考我在SO的问题git history of a function with overloading

这条指令可能对类似C语言适用,对于其他语言git也提供了相应的支持,需要配置一下。
参考:
generating diff text
Git - how do I view the change history of a method/function?
Is there a way to ask git diff to show the method name instead of the class name?

实例,对java的配置,
1. 添加

*.java	diff=java

~/.gitattributes
3. git config --global core.attributesfile "~/.gitattributes"

测试:
在这里插入图片描述

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值