查找作者修改的所有当前行

Find all current lines modified by an author

我如何在 git 中确定来自特定作者的所有行仍然存在。举个例子,一个 Tony 在我的项目上工作,我想在我的开发分支中找到所有仍然存在并且来自 Tony 创作的提交的行?

也许只是 git blame FILE | grep "Some Name".

或者如果你想递归地责备+搜索多个文件:

for file in $(git ls-files); do git blame $file | grep "Some Name"; done

注意:我最初建议使用下面的方法,但您可能 运行 遇到的问题是它也可能会在您的工作目录中找到 [=] 实际未跟踪的文件20=],因此 git blame 将对这些文件失败并中断循环。

find . -type f -name "*.foo" | xargs git blame | grep "Some Name"

sideshowbarker 大部分是正确的,但固定的第二个命令是:

find . -type f -exec git blame {} \; | grep "Some Name"

虽然我更愿意这样做:

for FILE in $(git ls-files) ; do git blame $FILE | grep "Some Name" ; done | less