How to grep (search) committed code in the Git history

后端 未结 15 1396

I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)?

A very poor solution is to grep the log:

15条回答
  •  野性不改
    2020-11-22 07:09

    For simplicity, I'd suggest using GUI: gitk - The Git repository browser. It's pretty flexible

    1. To search code:

    2. To search files:

    3. Of course, it also supports regular expressions:

    And you can navigate through the results using the up/down arrows.

提交回复
热议问题