1、用git blame -L xxx.c 多少行,+多少行以下几行(如+5)
root@gavin-desktop:/home/gavin/workdir/kernel_srcresp/linux-2.6# git blame -L 236,+5 arch/powerpc/Kconfig
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 236) config PPC_ADV_DEBUG_REGS
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 237) bool
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 23 depends on 40x || BOOKE
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 239) default y
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 240)
root@gavin-desktop:/home/gavin/workdir/kernel_srcresp/linux-2.6#
2、上面可以提供的信息有hash值、作者、相关宏定义
3.1 、根据hash值查找
(1) git diff-tree -p 172ae2e7 > xx.diff
(2) git format-patch -1 172ae2e7
3.2、根据作者查找patch
git log --author="Dave Kleikamp"
实际此方法只是列出此作者提交的所有patch的log,从而得到hash值再用3.1的方法得到patch
3.3、根据某个关键字查找
linux-2.6# git log --grep="CONFIG_PPC_ADV_DEBUG_REGS" arch/powerpc/Kconfig
commit 172ae2e7f8ff9053905a36672453a6d2ff95b182
Author: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Date: Mon Feb 8 11:50:57 2010 +0000
powerpc/booke: Introduce new CONFIG options for advanced debug registers
powerpc/booke: Introduce new CONFIG options for advanced debug registers
From: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Introduce new config options to simplify the ifdefs pertaining to the
advanced debug registers for booke and 40x processors:
CONFIG_PPC_ADV_DEBUG_REGS - boolean: true for dac-based processors
CONFIG_PPC_ADV_DEBUG_IACS - number of IAC registers
CONFIG_PPC_ADV_DEBUG_DACS - number of DAC registers
CONFIG_PPC_ADV_DEBUG_DVCS - number of DVC registers
CONFIG_PPC_ADV_DEBUG_DAC_RANGE - DAC ranges supported
Beginning conservatively, since I only have the facilities to test 440
hardware. I believe all 40x and booke platforms support at least 2 IAC
and 2 DAC registers. For 440, 4 IAC and 2 DVC registers are enabled, as
well as the DAC ranges.
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Acked-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
此方法同3.2,也是得到hash值再用3.1的方法得到patch
几种方法入手点不同,适合于不同的需要
这些东西肯定很多人都会用了,之前没用过git,只是需要找东西才拿起来试试,班门弄斧,请勿见怪