-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git-switch: add page #3246
git-switch: add page #3246
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}} {{start_point}}` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we should change "start_point" to "commit" to match with the other git pages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed — it also better reflects the description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed. I only used |
||
|
||
- Also update all submodules: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds somewhat informal. I am wondering if it sounds any better if we drop "Also" ? |
||
|
||
`git switch --recurse-submodules` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little confused by this; doesn't this need the target branch name to switch to? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does! I forgot to add that :P |
||
|
||
- Automatically merge the old branch and any uncommitted changes into the new branch: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think using "current" instead of "old" would be more explicit and clear. |
||
|
||
`git switch --merge {{branch_name}}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...and switch to it". Otherwise this is the same as
git branch {{branch_name}} {{commit}}
.