Tsallaka zuwa abun ciki
Justice Tech School

Finding Changes with log -S

git log -S finds commits that added or removed a piece of text.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo 'needle' >> a.txt && git commit -qam 'Add needle'
echo 'x' >> a.txt && git commit -qam 'Other'
git log -S needle --format=%s

Result

Add needle

Exercise

Search history.

git log  text

Quiz Test

What does -S find?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.