I have just noticed that I can still switch back to a branch after deleting it. Here is a particular example that I have:
git switch master
git branch -d AB-10/add_flights
...
// deleting also the remote branch on GitHub
git switch AB-10/add_flights
// I see the branch again
How come?
git switchis a newly introduced command to take some burden fromgit checkout.According to the manual of git checkout,
git checkout [<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.