Status: Accepted Date: 2026-04-19
In Git 2.23 (2019), git checkout was split into git switch (for
changing branches) and git restore (for discarding file changes). The
old checkout command does both, which confuses beginners — typing the
wrong argument can discard work instead of switching branches.
Teach git switch and git restore as the primary commands. Mention
git checkout once in chapter 01's introduction as a note so readers
recognise it in older tutorials.
- Teach checkout only: Matches most existing tutorials but perpetuates a confusing interface
- Teach both equally: Overloads the reader with two ways to do everything
- All chapter examples use
git switchfor branch changes - All chapter examples use
git restorefor discarding changes git checkoutappears only in a note explaining the split- Exercises use
git switch -cfor creating and switching in one step