New in Git: switch and restore

# · 🔥 868 · 💬 540 · 2 years ago · www.banterly.net · todsacerdoti · 📷
Git checkout is one of the many reasons why newcomers find git confusing. That's why in version 2.23 of git, two new commands have been introduced to replace the old git checkout(git checkout is still available, but people new to git should start with these ones preferably). While with git checkout you can switch to a commit and transition into a detached HEAD state, by default git switch does not allow that. Git switch -d f8c540805b7e16753c65619ca3d7514178353f39. Another difference is that with git checkout you can create and switch to the new branch in one command using the -b flag:git checkout -b new branch. You can do the same with the new one, but the flag is -c:git switch -c new branch. These methods are still marked experimental, but for all intents and purposes they are here to stay so by all means I encourage everyone to start using them since they will probably make a lot more sense in your head and also it will make git just a little bit less confusing to new users.
New in Git: switch and restore



Send Feedback | WebAssembly Version (beta)