[{"id":"gitbeginner-001","courseId":"git-beginner","domain":"repository-basics","topic":"Creating a repository with init","prompt":"You have a folder of project files and no Git history. You run `git init` inside it. What is true when the command finishes?","hint":"Think about what the command creates on disk, and whether it records any of your files.","explain":"Starting a repository builds an empty store inside the folder. Files only enter the history through later steps, so the new repository begins with nothing committed.","source":"https://git-scm.com/docs/git-init","interaction":{"type":"single"},"options":[{"id":"a","text":"A .git directory exists and no commits exist yet","why":"git init creates an empty repository: a .git directory and an initial branch that has no commits yet."},{"id":"b","text":"Your existing files are committed as the first commit","whyNot":"init records nothing. You still have to stage files with git add and record them with git commit."},{"id":"c","text":"The repository is created on a remote server","whyNot":"init only creates a local repository. It does not contact any server."},{"id":"d","text":"Every file in the folder is tracked automatically","whyNot":"Files are tracked only after you stage them with git add."}],"answer":"a","explanation":"git init creates an empty repository: a .git directory with objects, refs/heads and refs/tags, and an initial branch with no commits.","concept":"git init creates an empty repository: a .git directory with objects, refs/heads and refs/tags, and an initial branch with no commits.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"$ cd my-project\n$ git init","takeaways":["git init creates the repository but records no files; nothing is committed until you commit."]},{"id":"gitbeginner-002","courseId":"git-beginner","domain":"repository-basics","topic":"Staging changes with add","prompt":"Put these steps of the patch mode of git add in the order Git performs them.","hint":"Think about what the mode needs to show you for each piece of a file, and what it writes to the index.","explain":"Patch mode reviews one file's changes in pieces, each with its own yes-or-no choice. The staging area reflects the decisions you make, not the file as it sat on disk.","source":"https://git-scm.com/docs/git-add","interaction":{"type":"sort","items":[{"text":"Pick one changed path from a status-like list","why":"The mode starts by letting you choose a single file to review."},{"text":"See the diff between the index and that file","why":"Git needs this comparison before it can ask about any change."},{"text":"Answer y or n for each hunk","why":"Each hunk is staged or left out based on your answer."},{"text":"Update the index with the chosen hunks","why":"Git writes the selected changes to the index only after every hunk has a decision."}]},"options":[],"answer":"o:abcd","explanation":"Patch mode picks one path, shows its diff against the index, asks y or n for each hunk, then updates the index with the chosen hunks.","concept":"Patch mode picks one path, shows its diff against the index, asks y or n for each hunk, then updates the index with the chosen hunks.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Patch mode lets you stage part of a file, not just the whole file."]},{"id":"gitbeginner-003","courseId":"git-beginner","domain":"repository-basics","topic":"Recording a commit","prompt":"A teammate edits README.md, which Git already tracks, and never runs git add. Running `git commit -a` still records that edit in the new commit.","hint":"Consider what the -a option does before the commit is made.","explain":"A plain commit records only what is staged in the index. Some commit options also gather changes from the working tree first, and the kind of file they cover matters.","source":"https://git-scm.com/docs/git-commit","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","why":"commit -a looks at modified tracked files, runs the git add and git rm they need, and then records the commit."},{"id":"b","text":"False","whyNot":"An edit that was never staged stays out of the commit, since commit -a only picks up files already in the index."}],"answer":"a","explanation":"git commit -a looks at the working tree and performs the git add and git rm needed for modified tracked files before recording the commit.","concept":"git commit -a looks at the working tree and performs the git add and git rm needed for modified tracked files before recording the commit.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"$ git commit -a -m \"fix typo\"","takeaways":["commit -a covers tracked files only; new untracked files still need git add."]},{"id":"gitbeginner-004","courseId":"git-beginner","domain":"repository-basics","topic":"Checking the working tree with status","prompt":"You run `git add notes.txt`, then edit notes.txt again before committing. What does git status show for notes.txt?","hint":"Git compares three places: the last commit, the index, and the files on disk.","explain":"git status compares the last commit, the index, and the working tree. One path can differ in more than one of these comparisons at the same time.","source":"https://git-scm.com/docs/git-status","interaction":{"type":"single"},"options":[{"id":"a","text":"Listed as staged and also as modified in the working tree","why":"Status reports index-versus-HEAD and working-tree-versus-index separately, so the file can show in both."},{"id":"b","text":"Listed only as staged, with the second edit hidden","whyNot":"Status reports unstaged working-tree changes too, so the second edit is shown."},{"id":"c","text":"Listed as untracked because it was edited again","whyNot":"Once added, the file is tracked; editing it does not make it untracked."},{"id":"d","text":"Not listed, because staged files are skipped","whyNot":"Status covers the index as well, so a staged file still appears."}],"answer":"a","explanation":"git status lists paths that differ between HEAD and the index, paths that differ between the index and the working tree, and untracked paths.","concept":"git status lists paths that differ between HEAD and the index, paths that differ between the index and the working tree, and untracked paths.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["A file can be staged and modified at the same time."]},{"id":"gitbeginner-005","courseId":"git-beginner","domain":"repository-basics","topic":"Viewing unstaged changes with diff","prompt":"You edited README.md but did not run git add. Which TWO commands show that edit as a diff?","hint":"Plain diff compares against one default place; naming a commit changes that.","explain":"A diff always compares two sides: the working tree, the index, HEAD, or another commit. The arguments you pass decide which two sides are compared, so check what each side holds before reading the output.","source":"https://git-scm.com/docs/git-diff","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"git diff","why":"With no commit named, diff compares the working tree with the index, which shows unstaged edits."},{"id":"b","text":"git diff HEAD","why":"Comparing the working tree with HEAD includes unstaged edits, so this edit appears."},{"id":"c","text":"git diff --cached","whyNot":"--cached compares the index with HEAD, so an edit that was never staged does not appear."},{"id":"d","text":"git log -p","whyNot":"log -p shows patches of commits already recorded, and an unstaged edit is in no commit yet."},{"id":"e","text":"git status","whyNot":"Plain status lists README.md as modified but shows no line-by-line diff unless -v is given."},{"id":"f","text":"git add README.md","whyNot":"add stages the file and does not display its changes."}],"answer":"ab","explanation":"git diff with no arguments compares the working tree with the index; git diff <commit> compares the working tree with that commit, so it also shows unstaged edits.","concept":"git diff with no arguments compares the working tree with the index; git diff <commit> compares the working tree with that commit, so it also shows unstaged edits.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Use git diff --cached to review what is staged for the next commit."]}]