use git switch and git restore instead of git checkout
checkout does multiple things which is confusing, especially to beginners; man page headings:
git-checkout - Switch branches or restore working tree files
git-switch - Switch branches
git-restore - Restore working tree files