Git

Git check for removed content in

2021-09-01  本文已影响0人  JaedenKil

In general, I'm sure some content was in a file, then got deleted sometime, I need to find out which commit made the change.

Say the content is "HelloWorld", the file is "DemoTest.json":

# To get only related commits
git log --oneline -G "HelloWorld" DemoTest.json

# Ignore case
git log -i --oneline -G "HelloWorld" DemoTest.json
# To get full contents of these commits
git log --follow -p -S "HelloWorld" DemoTest.json

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

上一篇 下一篇

猜你喜欢

热点阅读