Switch Current Branch (2) – Git Switch

git switch is a newly introduced command as a substitute for the git checkout command. git switch returns the same result as git checkout.
Comparison between git checkout and git switch
These two commands are almost the same except for some option differences. For example, the -b option for git checkout is the -c option for git switch. Below are the key commands in comparison with the git checkout command.
Switch the current branch
git switch [existing branch name]git checkout [existing branch name]
Create a new branch and switch to the new branch
git switch -c [new branch name]git checkout -b [new branch name]
Forcefully switch to another branch
git switch -f [existing branch name]git checkout -f [existing branch name]




