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 .
            Asked
            
        
        
            Active
            
        
            Viewed 470 times
        
    3
            
            
        - 
                    2Possible duplicate of [Retrieve the commit log for a specific line in a file?](http://stackoverflow.com/questions/8435343/retrieve-the-commit-log-for-a-specific-line-in-a-file) – Alexander O'Mara Oct 05 '16 at 05:44
- 
                    1`git log`'s options `-S` and `-L` can help. – ElpieKay Oct 05 '16 at 05:48
3 Answers
2
            You can do this via git blame filename.
 
    
    
        Theodore R. Smith
        
- 21,848
- 12
- 65
- 91
- 
                    Beware, this will show the last person to edit a line, and not necessarily who added it, which would be in the commit history. – Alexander O'Mara Oct 05 '16 at 05:43
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
