Challenge 1
Complete the Git command to restore file or index state.
git
Press Ctrl⌘Enter to check your answer
Build four disposable repositories or reset one disposable repository between trials. Trial 1: create a tracked working-tree edit while keeping the index at the desired version, then use the operation that changes only the working tree. Trial 2: stage an edit and then unstage it without losing the working-tree change. Trial 3: make a prior commit's version of one path the current index and working-tree version without moving `HEAD`. Trial 4: create a history with a change that should remain in the graph but whose effect must be reversed by a new commit. Before each command, write down the state that must change; after it, verify `HEAD`, `git status --short`, `git diff --cached`, `git diff`, and `git log --oneline --decorate --graph`. Success means you can justify the command from the desired state transition, predict which of the working tree, index, branch tip, and commit history will change, and verify those predictions with real Git. Include at least one case where two commands could make a file look similar but only one satisfies the required history outcome.
Challenge 1
git
Press Ctrl⌘Enter to check your answer
Challenge 2
git --staged <path>
Press Ctrl⌘Enter to check your answer
Challenge 3
git --staged notes.txt
Press Ctrl⌘Enter to check your answer
Challenge 4
git --source=<tree> --staged --worktree <path>
Press Ctrl⌘Enter to check your answer