开发者

How to get list of commits that touched a given line of code (git)

I want to cherry pick开发者_JS百科 from one branch to another, but they diverged strongly. How can I get list of commits that modified a given part of the file?


2 common solutions:

  • git blame

Annotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision.

The command can also limit the range of lines annotated.

  • git bisect

to quickly determine what commit did introduce a specific change.

See also "Using git to find first introduction of token on a specific line of a file…"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜