What does git checkout still do after git switch got introduced?

Viewed 1451

As everyone knows, git checkout is a very overloaded command. And I do understand that certain commands got introduced to distribute, e.g. to git switch.

Before I used the following commands:

$ git checkout <existing-branch>
$ git checkout <hash>
$ git checkout -b <new-branch-name>

So I am wondering after git switch got introduced, what is the left purpose of git-checkout? Is this a deprecated command?

1 Answers

It's retained at least for backward compatibility. Think about millions of scripts that still use git checkout — should we hurry to rewrite all of them? Certainly no.

It's not even deprecated, actually. There is nothing about deprecation in the docs. On the other hand the docs for git restore and git switch say "THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE."

Related