-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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?
Changes from 8 commits
3dfca7a
04d35ec
b3a7389
b3d4000
7650e29
08e1530
e3aec28
793835a
a577b68
2623c20
f68041d
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 |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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
from the man page
Note: that the |
||
git switch -n cool-new-feature | ||
|
||
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 | ||
github repo. Generally (if you followed the instructions in these pages, and by | ||
default), git will have a link to your github repo, called ``origin``. You push | ||
up to your own repo on github with:: | ||
|
||
git push origin my-new-feature | ||
git push origin cool-new-feature | ||
|
||
In git >= 1.7 you can ensure that the link is correctly set by using the | ||
``--set-upstream`` option:: | ||
|
||
git push --set-upstream origin my-new-feature | ||
git push --set-upstream origin cool-new-feature | ||
|
||
From now on git will know that ``my-new-feature`` is related to the | ||
``my-new-feature`` branch in the github repo. | ||
From now on git will know that ``cool-new-feature`` is related to the | ||
``cool-new-feature`` branch in the github repo. | ||
|
||
.. _edit-flow: | ||
|
||
|
@@ -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 commentThe 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 commentThe 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 commentThe 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 | ||
# | ||
|
@@ -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 | ||
|
@@ -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 -c cool-feature --track someone/cool-feature | ||
# make a backup in case you mess up | ||
git branch tmp cool-feature | ||
# rebase cool-feature onto trunk | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
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. Could be combined with the branch command above, as before. 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. 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. | ||
|
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?