github - 搜索git历史记录中的内容
某草草
某草草 2017-04-27 09:02:34
0
3
733

可能在某个版本中提交了某些内容,后来由于某种原因删掉了,除了一条一条查看历史记录之外,还有别的方式去找到这些内容吗?

某草草
某草草

reply all(3)
伊谢尔伦

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?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template