Recall & Review
beginner
What does the
-S option do in git log?The
-S option searches for commits that add or remove a specific string in the code. It helps find changes related to that exact text.Click to reveal answer
intermediate
How is
git log -S different from git log -G?-S searches for changes in the number of occurrences of a string, while -G searches for commits that match a regular expression pattern in the diff.Click to reveal answer
beginner
Write a command to find commits that added or removed the word 'bugfix' in the project history.
git log -S'bugfix'Click to reveal answer
intermediate
Can
git log -S search for changes in binary files?No,
git log -S works only with text changes. It cannot search inside binary files.Click to reveal answer
beginner
Why might
git log -S be useful when debugging?It helps find exactly when a specific piece of code was added or removed, making it easier to track down when a bug was introduced or fixed.
Click to reveal answer
What does
git log -S'functionName' do?✗ Incorrect
-S finds commits where the number of occurrences of the string changes, so it shows commits that added or removed 'functionName'.
Which option would you use to search commits by a regular expression pattern?
✗ Incorrect
-G searches commits by matching a regex pattern in the diff.
If you want to find when a variable name was changed, which command helps best?
✗ Incorrect
git log -S finds commits that added or removed the variable name.
Does
git log -S show commits that only mention the string in commit messages?✗ Incorrect
-S searches for changes in the code, not commit messages.
What is a practical use of
git log -S?✗ Incorrect
git log -S helps find commits that changed a specific string in the code.
Explain how
git log -S helps you find when a specific piece of code was added or removed.Think about how you find when a word first appeared or disappeared in your project.
You got /3 concepts.
Describe the difference between
git log -S and git log -G.One looks for exact string changes, the other for pattern matches.
You got /3 concepts.