相关疑难解决方法(0)

Git - 如何查看方法/函数的更改历史记录?

所以我找到了关于如何查看文件的更改历史记录的问题,但是这个特定文件的更改历史记录很大,我真的只对特定方法的更改感兴趣.那么就可以看到该特定方法的变更历史吗?

我知道这需要git来分析代码,并且分析对于不同的语言会有所不同,但是在大多数语言中方法/函数声明看起来非常相似,所以我想也许有人已经实现了这个功能.

我目前使用的语言是Objective-C,我目前使用的SCM是git,但我很想知道这个功能是否适用于任何SCM /语言.

git methods history function objective-c

81
推荐指数
7
解决办法
2万
查看次数

有没有办法让git diff显示方法名而不是类名?

这已经困扰了我一段时间,搜索没有提示.

问题:

当我git diff在包含a的PHP文件上执行操作时Class,每个hunk描述都有类名,没有提到方法名.

例如:

@@ -351,7 +351,7 @@ class Session
             $form->setError($field, $subpassValid['msg']);
       }

       // E-Mail address error checking
       $field = "email";  //Use field name for email
-       if(!isset($subemail) || strlen($subemail = trim($subemail)) == 0){
+       if(!$subemail || strlen($subemail = trim($subemail)) == 0){
          $form->setError($field, "* Email not entered");
@@ -373,7 +373,7 @@ class Session
...
Run Code Online (Sandbox Code Playgroud)

题:

有没有办法告诉git显示方法名称而不是/沿着类名称?

编辑:

附加信息:

diff version: 2.8.1
git version: 1.7.6 (from the git-core PPA)
OS: Ubuntu 9.10
Run Code Online (Sandbox Code Playgroud)

我最初从股票Ubuntu repos获得了git版本1.7.0.4,但更新了它,希望它是一个bug.不幸的是,这并没有解决问题. …

php git diff

24
推荐指数
2
解决办法
3315
查看次数

标签 统计

git ×2

diff ×1

function ×1

history ×1

methods ×1

objective-c ×1

php ×1