A line of code in a file was modified to an incorrect code. How can I use the git command to find out who modified the code? git blame filepath
Since there are too many file modification records and all are displayed, how can we find the culprit more accurately and quickly
git blame filepath | grep 'code'
or
git blame filepath | grep 'lineNO)'
You can use the sourcetree tool. In this tool, the operations are all interface-based, and it is more convenient to search for records.
The fastest one is probably blame. Just find that line and see who wrote the commit
You can also
git log -p -M --follow --stat -- 文件名
and searchvim file.name Enter the file, move the cursor to this line, and then ":Gblame", the record of who modified this line will be displayed on the left.