可能在某个版本中提交了某些内容,后来由于某种原因删掉了,除了一条一条查看历史记录之外,还有别的方式去找到这些内容吗?
伊谢尔伦2017-04-27 09:04:34
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 idgit log -G"删除掉内容" -p
Evian added: -G
是查正则的。查文本用 -S
.
PHP中文网2017-04-27 09:04:34
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