Do not use ‘git checkout’ anymore

It’s a command that Git has added in Git 2.23. It works similarly to the checkout command. But not exactly same. To understand more deeply, let’s summarize the role of checkout.

checkout : Switch branches or restore working tree files

official docs explains checkout like above. Git 2.23 made two other command to separate and replace this.

  • switch: switch branches
  • restore: Restore working tree files

You can now write commands specifically for situations that are much more appropriate.

if you want to switch branches than we can use

and also you can use if you restore a file

Like this now we don’t need to use checkout anymore :)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Frontend Dev from Seoul, South Korea