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”.
import { menu } from './menu.js'import { renderCart } from './cart.js'const cart = []export function addToCart(id) {const item = menu.find((m) => m.id === id)if (!item) returncart.push(item)console.log(cart)renderCart(cart)}
Graph
- df3488c Check adding to the cartHEAD → main
- ad832bd Show the total soonertag: v1.0.0
- 1354d06 Add menu pageorigin/main
- 619eb3b Style the order button
- 5fc44ac Initial commit