3

I want to check who added the few lines of code in the particular file , as all 3 developers are working on the same file .

3 Answers3

2

You can do this via git blame filename.

Theodore R. Smith
  • 21,848
  • 12
  • 65
  • 91
1

To see who was the last person to touch each line of code, use git blame. To see which commits inserted or removed certain pattern/lines that you're interested in, use the pickaxe. It helps you find which commits made changes that match a pattern you're interested in (e.g. "who changed this line use a debug rather that critical logger" even if the line currently is critical).

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
1

You can use git blame with the -L option, where n is the first line and m the last line inspected. The following example will show the last commit done to line number 10.

git blame -L 10,10

If you want the complete history including the first commit (you ask for when the line was added), you can use git log, e.g:

git log -L 10,10:myFile.txt
sp1nakr
  • 378
  • 2
  • 12