We all learn Git the hard way. You start with add, commit, push — and that works until the day you accidentally commit to main or delete a branch you meant to keep.
Here are 10 Git commands I discovered way later than I should have. Each one saved me from a real mess.
1. git switch — The Safe Checkout
I used git checkout for everything: switching branches, restoring files, creating new branches. Until one day I ran:
git checkout some-file.txt






