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

Use git switch instead of git checkout or git branch #7216

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

anamfatima1304
Copy link
Contributor

@anamfatima1304 anamfatima1304 commented Oct 19, 2023

Closes #7213

This Pull Request replaces the command "git-checkout" with "git-switch" in the documentation.

@mkcor
Copy link
Member

mkcor commented Oct 19, 2023

Thank you, @anamfatima1304! There are other instances of git checkout in our docs, e.g., in INSTALL.rst or
doc/source/gitwash/development_workflow.rst 😉

@anamfatima1304
Copy link
Contributor Author

Thank You @mkcor I will change the other instances as well.

@stefanv stefanv added the 📄 type: Documentation Updates, fixes and additions to documentation label Oct 19, 2023
Copy link
Member

@stefanv stefanv left a 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)
Copy link
Member

Choose a reason for hiding this comment

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

This change is incorrect.

Copy link
Contributor Author

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?

Copy link
Member

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.

doc/source/gitwash/development_workflow.rst Outdated Show resolved Hide resolved
RELEASE.txt Outdated Show resolved Hide resolved
doc/source/gitwash/maintainer_workflow.rst Outdated Show resolved Hide resolved
doc/source/gitwash/patching.rst Outdated Show resolved Hide resolved
@@ -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
Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

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

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.

Copy link
Contributor Author

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?

Copy link
Member

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?

@lagru lagru changed the title Replaced git checkout in CONTRIBUTING.rst Use git switch instead of git checkout or git branch Oct 20, 2023
@lagru
Copy link
Member

lagru commented Apr 17, 2024

After revisiting this, I'd suggest reverting the changes that touch doc/source/gitwash which is a git submodule. We are better of updating that upstream and incorporating changes that way.

I'm happy to merge the other changes. @anamfatima1304 would you be willing to undo the changes that touch files in doc/source/gitwash? Sorry for not communicating this from the start. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 type: Documentation Updates, fixes and additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace git checkout with git switch where possible
4 participants