-
git switch and git restore: the split you probably missed (as I did)
git checkout has been split into git switch and git restore. git checkout main and git switch main do exactly the same thing. So why does the second one exist? Because checkout is two commands wearing one name. It moves HEAD to another branch, and it overwrites files in your working tree from some commit. Those operations have nothing in common except that both touch files on disk — and one of them is destructive. That collision produces a genuinely bad failure mode: Same verb, same shape, no confirmation, no reflog entry to crawl back through. The working-tree copy is simply gone. And when a branch and a path share…