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
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ can be contributed to scikit-image.

* Pull the latest changes from upstream::

git checkout main
git switch main
git pull upstream main

* Create a branch for the feature you want to work on. Use a sensible name,
such as 'transform-speedups'::

git checkout -b transform-speedups
git switch -c transform-speedups

* Commit locally as you progress (with ``git add`` and ``git commit``).
Please write `good commit messages
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ source:

.. code-block:: sh

git checkout main
git switch main
git pull upstream main

And you likely want to create a feature branch from there.
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ If you want to take matters into your own hands for some reason, follow the
instructions detailed below to cut a Debian release yourself.

- Tag the release as per instructions above.
- git checkout debian
- git switch debian
anamfatima1304 marked this conversation as resolved.
Show resolved Hide resolved
- git merge v0.x.x
- uscan <- not sure if this step is necessary
- Update changelog (emacs has a good mode, requires package dpkg-dev-el)
Expand Down
8 changes: 4 additions & 4 deletions doc/source/gitwash/development_workflow.rst
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?

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ what the changes in the branch are for. For example ``add-ability-to-fly``, or
git fetch upstream
# Make new feature branch starting at current trunk
git branch my-new-feature upstream/main
git checkout my-new-feature
git switch my-new-feature
anamfatima1304 marked this conversation as resolved.
Show resolved Hide resolved

Generally, you will want to keep your feature branches on your public github_
fork of `scikit-image`_. To do this, you `git push`_ this new branch up to your
Expand Down Expand Up @@ -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.

#
# modified: README
#
Expand Down Expand Up @@ -176,7 +176,7 @@ Delete a branch on github

::

git checkout main
git switch main
# delete branch locally
git branch -D my-unwanted-branch
# delete branch on github
Expand Down Expand Up @@ -271,7 +271,7 @@ To do a rebase on trunk::
# Update the mirror of trunk
git fetch upstream
# go to the feature branch
git checkout cool-feature
git switch cool-feature
# make a backup in case you mess up
git branch tmp cool-feature
# rebase cool-feature onto trunk
Expand Down
2 changes: 1 addition & 1 deletion doc/source/gitwash/git_resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ online manual pages for some common commands:

* `git add`_
* `git branch`_
* `git checkout`_
* `git switch`_
* `git clone`_
* `git commit`_
* `git config`_
Expand Down
2 changes: 1 addition & 1 deletion doc/source/gitwash/maintainer_workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
anamfatima1304 marked this conversation as resolved.
Show resolved Hide resolved
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?


So now you are on the branch with the changes to be incorporated upstream. The
rest of this section assumes you are on this branch.
Expand Down
8 changes: 4 additions & 4 deletions doc/source/gitwash/patching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Overview
# make a branch for your patching
cd scikit-image
git branch the-fix-im-thinking-of
anamfatima1304 marked this conversation as resolved.
Show resolved Hide resolved
git checkout the-fix-im-thinking-of
git switch the-fix-im-thinking-of
# hack, hack, hack
# Tell git about any new files you've made
git add somewhere/tests/test_my_bug.py
Expand Down Expand Up @@ -68,7 +68,7 @@ In detail
branch::

git branch the-fix-im-thinking-of
git checkout the-fix-im-thinking-of
git switch the-fix-im-thinking-of

#. Do some edits, and commit them as you go::

Expand Down Expand Up @@ -105,7 +105,7 @@ In detail
When you are done, to switch back to the main copy of the
code, just return to the ``main`` branch::

git checkout main
git switch main

Moving from patching to development
===================================
Expand All @@ -119,7 +119,7 @@ Fork the `scikit-image`_ repository on github |emdash| :ref:`forking`.
Then::

# checkout and refresh main branch from main repo
git checkout main
git switch main
git pull origin main
# rename pointer to main repository to 'upstream'
git remote rename origin upstream
Expand Down