git switch <branch name> [start point]

Switch branches

Arguments

NameDescription
branch nameBranch or commit to switch to
start point

Options

NameDescription
-c, --create <new branch> [start point]Create a new branch named <new-branch> starting at <start-point> before switching to the branch
-C, --force-create <new branch> [start point]Similar to --create except that if <new-branch> already exists it will be reset to <start-point>
-d, --detachSwitch to a commit for inspection and discardable experiments
--guessIf <branch> is not found but there does exist a tracking branch in exactly one remote (call it <remote>) with a matching name
--no-guessDisable --guess
-f, --force
  • Dangerous 💥
--discard-changes
  • Dangerous 💥
-m, --mergeIf you have local modifications to one or more files that are different between the current branch and the branch to which you are switching, the command refuses to switch branches in order to preserve your modifications in context
--conflict <style>The same as --merge option above, but changes the way the conflicting hunks are presented, overriding the merge.conflictStyle configuration variable
-q, --quietQuiet, suppress feedback messages
--progressProgress status is reported on the standard error stream by default when it is attached to a terminal
--no-progressDisable progress status reporting
-t, --track <branch> [start point]When creating a new branch, set up 'upstream' configuration
--no-track <arg> [arg]Do not set up 'upstream' configuration, even if the branch.autoSetupMerge configuration variable is true
--orphan <new branch>Create a new orphan branch, named <new-branch>
--ignore-other-worktreesGit switch refuses when the wanted ref is already checked out by another worktree
--recurse-submodulesUpdates the content of all active submodules according to the commit recorded in the superproject
--no-recurse-submodulesSubmodules working trees will not be updated