gitpractice.dev

brewly — Ch.9 · Search the code

Exercise 3 of 5

Before you start

git grep

git grep <text> searches the files git tracks, so it skips things like node_modules.

Give a tag or commit after the text to search that version instead of your files.

"Write the code" removes the debug lines once you have found them.

git grep -n <text>
matching lines with line numbers
git grep -n <text> <tag>
search an older version
git grep -l <text>
only the file names
git commit -am "What you did"
commit the cleanup
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path