mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-10 22:47:03 +00:00
Update cheatsheets
This commit is contained in:
34
git-switch
Normal file
34
git-switch
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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 and switch to it:
|
||||
|
||||
`git switch --create {{branch_name}} {{commit}}`
|
||||
|
||||
- Switch to the previous branch:
|
||||
|
||||
`git switch -`
|
||||
|
||||
- Switch to a branch and update all submodules to match:
|
||||
|
||||
`git switch --recurse-submodules {{branch_name}}`
|
||||
|
||||
- Switch to a branch and automatically merge the current branch and any uncommitted changes into it:
|
||||
|
||||
`git switch --merge {{branch_name}}`
|
||||
Reference in New Issue
Block a user