checkout is one of the most confusing commands for new comers. This Stackoverflow explains how it can be replaced with switch and restore.
git switchcan now be used to change branches, asgit checkout <branchname>doesgit restorecan be used to reset files to certain revisions, asgit checkout -- <path_to_file>does
You must log in or # to comment.
They’re interchangeable for branches. Checkout works with arbitrary refs like commit hashes and tags as well. For these, switch needs the --detach flag. You can also use it to create a new branch from the current commit with ’git switch -c $branch_name’.



