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…"
精彩评论