Skip to content
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

Merged
merged 4 commits into from
Aug 19, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pages/common/git-switch.md
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:
Copy link
Member

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}}.


`git switch --create {{branch_name}} {{start_point}}`
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — it also better reflects the description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed. I only used start_point because that's the language that the documentation page uses.


- Also update all submodules:
Copy link
Member

Choose a reason for hiding this comment

The 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`
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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:
Copy link
Member

Choose a reason for hiding this comment

The 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}}`