Using git to find first introduction of token on a specific line of a file

前端 未结 5 1041
星月不相逢
星月不相逢 2021-01-04 07:36

Let\'s say I have a file A.cpp, and I notice an error on line 15 of the file. Let\'s say the error is a \"const\" on a function that returns a pointer to a member variable,

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 08:05

    If the line existed without the const token in some commit that you know, you can start there and use the --reverse flag on git-blame to find the last revision in which the line didn't have the const token. Then just look at the next revision on the file after that.

提交回复
热议问题