mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-07 19:05:59 +02:00
git-switch: add page (#3246)
This commit is contained in:
parent
35a877f105
commit
48ce816e61
1 changed files with 25 additions and 0 deletions
25
pages/common/git-switch.md
Normal file
25
pages/common/git-switch.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# git switch
|
||||||
|
|
||||||
|
> Switch between git branches. Requires git version 2.23+.
|
||||||
|
> See also `git checkout`.
|
||||||
|
> More information: <https://git-scm.com/docs/git-switch/>.
|
||||||
|
|
||||||
|
- 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}}`
|
Loading…
Add table
Reference in a new issue