查看一个文件指定范围内的所有修改记录

1
git log -p -2 -L1081,+5:'hello/world.go'

-p -2 或者 --patch -2

往前展示两个 commit 的 diff . 在 git 中 commit 和 patch 是同一个意思参考下文.

git commands patching

A few commands in Git are centered around the concept of thinking of commits in terms of the changes they introduce, as though the commit series is a series of patches.

-L 语法 -L<start>,<end>:<file>, -L:<funcname>:<file>

限制指定查看范围.