Skip to content

Instantly share code, notes, and snippets.

@kfitfk
Last active May 9, 2022 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfitfk/2fc7fcf0cb91907abd2227e206124aba to your computer and use it in GitHub Desktop.
Save kfitfk/2fc7fcf0cb91907abd2227e206124aba to your computer and use it in GitHub Desktop.
Search modified files to see if they include a term; 在 git 文件修改历史内容中查询某个关键词
git log -Sword
git log -Gword
  • -G by default accepts a regex, while -S accepts a string, but it can be modified to accept regexes using the --pickaxe-regex.
  • -S finds commits where the number of occurrences of "word" changed, while -G finds commits where "word" appears in the diff.
  • This means that -S<regex> --pickaxe-regex and -G<regex> do not do exactly the same thing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment