Oliver Williams
Oliver Williams

Reputation: 6364

git search commits for changed string and list files with that string in that commit

I have managed to find a resource to search for "a" string in all commits (link below). But I do not know how to do the same command and have the specific files within the commits be listed (which added or lost that string).

All commits would be good but ideally I'd also like to get a list of files that added or lost that string within a specific commit. How would I do this for all or a specific commit?

Finding a Git commit that introduced a string in any branch

Upvotes: 2

Views: 236

Answers (1)

VonC
VonC

Reputation: 1328202

You can get the log of a specific commit with:

git log -1 <aSHA1>

So add your pickaxe search to that:

git log --name-only -1 -S "<whatever>" <aSHA1>

Upvotes: 1

Related Questions