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

前端 未结 5 1394
半阙折子戏
半阙折子戏 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:36

    Without more details I can only hint at possible solutions. If you know the file or line affected, you can try either git-blame (git blame *file*, or git blame *revision* *file*), or you can try so called 'pickaxe search' with git-log, i.e. git log -S'*line* trying to find revision which introduced given line, or deleted given line. You can find and examine all merges, for example via git log -p -m --grep=Merge, and examine how they relate to their parents (-m show diffs to all parents; alternatively -c shows combined diff but doesn't show trivial merge changes, i.e. if one side was taken).

提交回复
热议问题