How to find out in which commit a particular code was added?

前端 未结 5 704
执念已碎
执念已碎 2020-12-22 22:13

I want to find out in which commit did I add the code given below:

if (getListView().getChildCount() == 0)
                getActivity().findViewById(androi         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 22:49

    There is something quicker than issuing a blame on the full file. If the line is ${lineno} and the file is ${filename} you can:

    git blame -L ${lineno},${lineno} ${filename}
    

    Example:

    git blame -L 2,2 test.txt
    

提交回复
热议问题