-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update contributing guide regarding updating a pull request (merge master) #19990
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
Changes from 2 commits
bada3ca
f24deb4
9245e86
c5b0475
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 |
---|---|---|
|
@@ -246,16 +246,16 @@ changes in this branch specific to one bug or feature so it is clear | |
what the branch brings to *pandas*. You can have many shiny-new-features | ||
and switch in between them using the git checkout command. | ||
|
||
To update this branch, you need to retrieve the changes from the master branch:: | ||
When creating this branch, make sure your master branch is up to date with | ||
the latest upstream master version. To update your local master branch, you | ||
can do:: | ||
|
||
git fetch upstream | ||
git rebase upstream/master | ||
git checkout master | ||
git pull upstream master --ff-only | ||
|
||
This will replay your commits on top of the latest pandas git master. If this | ||
leads to merge conflicts, you must resolve these before submitting your pull | ||
request. If you have uncommitted changes, you will need to ``stash`` them prior | ||
to updating. This will effectively store your changes and they can be reapplied | ||
after updating. | ||
When you want to update the feature branch with changes in master after | ||
you created the branch, check the section on | ||
:ref:`updating a PR <contributing.update-pr>`. | ||
|
||
.. _contributing.documentation: | ||
|
||
|
@@ -964,32 +964,6 @@ Now you can commit your changes in your local repository:: | |
|
||
git commit -m | ||
|
||
Combining commits | ||
----------------- | ||
|
||
If you have multiple commits, you may want to combine them into one commit, often | ||
referred to as "squashing" or "rebasing". This is a common request by package maintainers | ||
when submitting a pull request as it maintains a more compact commit history. To rebase | ||
your commits:: | ||
|
||
git rebase -i HEAD~# | ||
|
||
Where # is the number of commits you want to combine. Then you can pick the relevant | ||
commit message and discard others. | ||
|
||
To squash to the master branch do:: | ||
|
||
git rebase -i master | ||
|
||
Use the ``s`` option on a commit to ``squash``, meaning to keep the commit messages, | ||
or ``f`` to ``fixup``, meaning to merge the commit messages. | ||
|
||
Then you will need to push the branch (see below) forcefully to replace the current | ||
commits with the new ones:: | ||
|
||
git push origin shiny-new-feature -f | ||
|
||
|
||
Pushing your changes | ||
-------------------- | ||
|
||
|
@@ -1045,15 +1019,50 @@ release. To submit a pull request: | |
#. Click ``Send Pull Request``. | ||
|
||
This request then goes to the repository maintainers, and they will review | ||
the code. If you need to make more changes, you can make them in | ||
your branch, push them to GitHub, and the pull request will be automatically | ||
updated. Pushing them to GitHub again is done by:: | ||
the code. | ||
|
||
.. _contributing.update-pr: | ||
|
||
git push -f origin shiny-new-feature | ||
Updating your pull request | ||
-------------------------- | ||
|
||
Based on the review you get on your pull request, you will probably need to make | ||
some changes to the code. In that case, you can make them in your branch, | ||
add a new commit to that branch, push it to GitHub, and the pull request will be | ||
automatically updated. Pushing them to GitHub again is done by:: | ||
|
||
git push origin shiny-new-feature | ||
|
||
This will automatically update your pull request with the latest code and restart the | ||
:ref:`Continuous Integration <contributing.ci>` tests. | ||
|
||
Another reason you might need to update your pull request is to solve conflicts | ||
with changes that have been merged into the master branch since you opened your | ||
pull request. | ||
|
||
To do this, you need to "merge upstream master" in your branch:: | ||
|
||
git checkout shiny-new-feature | ||
git fetch upstream | ||
git merge upstream/master | ||
|
||
If there are no conflicts (or they could be fixed automatically), a file with a | ||
default commit message will open, and you can simply save and quit this file. | ||
|
||
If there are merge conflicts, you need to solve those conflicts. See for | ||
example at https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ | ||
for an explanation on how to do this. | ||
Once the conflicts are merged and the files where the conflicts were solved are | ||
added, you can run ``git commit`` to save those fixes. | ||
|
||
If you have uncommitted changes at the moment you want to update the branch with | ||
master, you will need to ``stash`` them prior to updating. This will effectively | ||
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. maybe add a reference to git stash here (git docs) 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. done |
||
store your changes and they can be reapplied after updating. | ||
|
||
After the feature branch has been update locally, you can now update your pull | ||
request by pushing to the branch on GitHub:: | ||
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. maybe add a comment about |
||
|
||
git push origin shiny-new-feature | ||
|
||
Delete your merged branch (optional) | ||
------------------------------------ | ||
|
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.
need to make this an http ref
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.
sphinx does that automatically