How to search a git repository history to find a merge error?

前端 未结 5 1239
半阙折子戏
半阙折子戏 2021-02-09 00:17

At some point in our past branches of development in git were merged. However, the wrong merge decision was made and therefore some code didn\'t make it into master branch tha

5条回答
  •  醉话见心
    2021-02-09 00:48

    Git log has powerful searching options. Since there's the indication you might know a chunk of code that disappeared, you can search for that string of code

    git log .. -S"line I care about" --diff-filter=M

    Will search from HERE to THERE for the string after -S and only where the line was modified (added or removed)

    You can achieve even more precision in your search if you use -G instead of -S. -G provides regular expression searching instead of string literal searching with -S.

提交回复
热议问题