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
Use git switch
instead of git checkout
or git branch
#7216
base: main
Are you sure you want to change the base?
Use git switch
instead of git checkout
or git branch
#7216
Conversation
Thank you, @anamfatima1304! There are other instances of |
Thank You @mkcor I will change the other instances as well. |
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.
Thanks for these updates @anamfatima1304. Please ensure that git switch branch-name
or git switch -c branch-name
(create new branch) are used consistently throughout.
@@ -121,7 +121,7 @@ In more detail | |||
# On branch ny-new-feature | |||
# Changed but not updated: | |||
# (use "git add <file>..." to update what will be committed) | |||
# (use "git checkout -- <file>..." to discard changes in working directory) | |||
# (use "git switch -- <file>..." to discard changes in working directory) |
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.
This change is incorrect.
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.
Oh, I am sorry. @stefanv Should I use "git switch --detach " instead?
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.
No, this is output generated by git, so should be left alone. Or, best to simulate it with a recent version of git to see what the output looks like now that branch/restore are available.
@@ -77,24 +77,24 @@ what the changes in the branch are for. For example ``add-ability-to-fly``, or | |||
# Update the mirror of trunk | |||
git fetch upstream | |||
# Make new feature branch starting at current trunk | |||
git branch my-new-feature upstream/main | |||
git checkout my-new-feature | |||
git branch cool-new-feature upstream/main |
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.
This line is no longer needed.
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.
I'd replace both lines (this one and the one below) with the equivalent command
git switch -c cool-new-feature upstream/main
from the man page
git switch [<options>] (-c|-C) <new-branch> [<start-point>]
Note: that the -n
option in the line below doesn't exist.
@@ -121,7 +121,7 @@ In more detail | |||
# On branch ny-new-feature | |||
# Changed but not updated: | |||
# (use "git add <file>..." to update what will be committed) | |||
# (use "git checkout -- <file>..." to discard changes in working directory) | |||
# (use "git switch -- <file>..." to discard changes in working directory) |
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.
No, this is output generated by git, so should be left alone. Or, best to simulate it with a recent version of git to see what the output looks like now that branch/restore are available.
@@ -32,7 +32,7 @@ looking at someone's changes like this:: | |||
git remote add someone https://github.com/someone/scikit-image.git | |||
git fetch someone | |||
git branch cool-feature --track someone/cool-feature | |||
git checkout cool-feature | |||
git switch cool-feature |
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.
Could be combined with the branch command above, as before.
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.
Thank You @stefanv Should I just remove line number 35 then?
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.
Hmm, I think gitwash is a git submodule. It seems possible to commit changes here but we might want to upstream these changes as well or instead? Thoughts?
git switch
instead of git checkout
or git branch
After revisiting this, I'd suggest reverting the changes that touch I'm happy to merge the other changes. @anamfatima1304 would you be willing to undo the changes that touch files in |
Closes #7213
This Pull Request replaces the command "git-checkout" with "git-switch" in the documentation.