If you want to switch to an existing branch called feature1, you can simply run:
git switch feature1
If you want to create a new branch called feature2 based on the current branch and switch to it, you can run:
git switch -c feature2
If you want to switch to a specific commit with the hash 1234567 without creating a new branch, you can run:
git switch --detach 1234567
If you want to merge your current branch into master before switching to it, you can run:
git switch -m master
If you want to force-switch to another branch called feature3 and discard any uncommitted changes in your working directory and staging area, you can run:
git switch -f feature3