Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git Switch

This command was added to Git in 2019 (2.23), after user feedback that checkout was destructive in some cases.

switch updates the working tree, and index to match the new branch.

Important

The destructive form of this command is --discard-changes.

Make A New Branch

git switch -c newbranch

Make A New Branch From A Specific Commit

git switch -c newbranch <commit>

References

Git - git-switch Documentation

Last Modified • Sunday, June 14, 2026. 5:09 am UTC+00:00 • Commit: 4a9f867