Git log - find completions of specified line
How can I search my git history for commits containing only appends of the specified line?
For example, how can I find all commits containing additions System.out.println
or debugger
.
I know of an argument -S
that can be passed to git log
, but it includes all commits containing additions or subtractions of the specified line.
Is there a natural way to do this?
source to share
Try the following:
To find the commit log for a given line:
git log --all --grep='specific string'
To find the actual content of the commits in the repository:
git grep 'specific string' $(git rev-list --all)
It will provide all instances of the given text, containing the filename and commit.
Hope this is what you want.
Update
Also check the following two links:
source to share