I found git log -p |grep "删除掉内容" It seems feasible. I wonder if there is a better way?
If you know which file was deleted, you can use git log -p "文件名" |grep "删除掉内容"
But we still don’t know which commit was deleted. . I'll update when I find a way.
Added:
This way you can find the deleted content and commit id git log -G"删除掉内容" -p
The search based on the log is not accurate, and the requirements for the commit msg originally written are too high. It is not as good as this git grep sth $(git rev-list --all)
I found
git log -p |grep "删除掉内容"
It seems feasible. I wonder if there is a better way?If you know which file was deleted, you can use
git log -p "文件名" |grep "删除掉内容"
But we still don’t know which commit was deleted. . I'll update when I find a way.
Added:
This way you can find the deleted content and commit id
git log -G"删除掉内容" -p
Evian added:
-G
是查正则的。查文本用-S
.The search based on the log is not accurate, and the requirements for the commit msg originally written are too high. It is not as good as this
git grep sth $(git rev-list --all)
from: http://stackoverflow.com/questions/2928584/how-to-grep-search-committed-code-in-the-git-history
Could you try git reflog to achieve your effect?