2

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

1 Answer 1

1

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> 
Sign up to request clarification or add additional context in comments.

4 Comments

both methods only give me the commit sha1, the author, and the date. No file or line data, sorry.
@OliverWilliams I have added the --name-only option for listing files (but not lines)
- however, and this is not the question I've asked, running the command shown on github doesn't seem to remove the sensitive data as I wished: help.github.com/articles/remove-sensitive-data
@OliverWilliams Indeed: could you ask a new question for that? (I have to go, but I will review it later)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.