git switch
is a newly introduced command to take some burden from git checkout
.
According to the manual of git checkout,
git checkout [<branch>]
To prepare for working on <branch>, switch to
it by updating the index and the files in the working tree, and by
pointing HEAD at the branch. Local modifications to the files in the
working tree are kept, so that they can be committed to the <branch>.
If is not found but there does exist a tracking branch in
exactly one remote (call it <remote>) with a matching name and
--no-guess is not specified, treat as equivalent to
$ git checkout -b <branch> --track <remote>/<branch>
So after you delete the branch and run git checkout <branch>
, it's created from <remote>/<branch>
again.
It also applies to git switch
.