From 48ce816e6175dca98b56a2adbcba882e9eb1f093 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 19 Aug 2019 13:44:48 +0100 Subject: [PATCH] git-switch: add page (#3246) --- pages/common/git-switch.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pages/common/git-switch.md diff --git a/pages/common/git-switch.md b/pages/common/git-switch.md new file mode 100644 index 000000000..d0baeb3a2 --- /dev/null +++ b/pages/common/git-switch.md @@ -0,0 +1,25 @@ +# git switch + +> Switch between git branches. Requires git version 2.23+. +> See also `git checkout`. +> More information: . + +- Switch to an existing branch: + +`git switch {{branch_name}}` + +- Create a new branch and switch to it: + +`git switch --create {{branch_name}}` + +- Create a new branch based on an existing commit: + +`git switch --create {{branch_name}} {{commit}}` + +- Update all submodules to match the target branch: + +`git switch --recurse-submodules {{branch_name}}` + +- Automatically merge the current branch and any uncommitted changes into the new branch: + +`git switch --merge {{branch_name}}`