Skip Navigation

git checkout vs git switch vs git restore

stackoverflow.com What's the difference between git switch and git checkout <branch>

Git 2.23 introduces a new command git switch -- after reading the docs, it seems pretty much the same as git checkout &lt;branchname&gt; can someone explain the difference or use case? Two new

What's the difference between git switch and git checkout <branch>

checkout is one of the most confusing commands for new comers. This Stackoverflow explains how it can be replaced with switch and restore.

  • git switch can now be used to change branches, as git checkout <branchname> does
  • git restore can be used to reset files to certain revisions, as git checkout -- <path_to_file> does
1
1 comments