Skip to content

Snickerdoodle


Setup

Run the following code to set up a new git repo with two files, ingredients.txt and instructions.txt.

cd path/to/parent/dir/
mkdir snickerdoodle
cd snickerdoodle
git init
echo "cinnamon" > ingredients.txt
echo "butter" >> ingredients.txt
echo "flour" >> ingredients.txt
git add ingredients.txt
git commit -m "added ingredients"
echo "ground meat" >> ingredients.txt
echo "fire up the grill" > instructions.txt
path/to/parent/dir/
  snickerdoodle/
    ingredients.txt
    instructions.txt
bill@gates:~$ git status
On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   ingredients.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    instructions.txt
bill@gates:~$ git log --oneline
b6c03ee (HEAD -> main) added ingredients

Challenge

After committing the ingredients to make snickerdoodles 🍪, you mistakenly added ingredients and instructions for grilling hamburgers 🍔.

Remove all your unstaged, uncommitted changes accordingly.