-
-
Notifications
You must be signed in to change notification settings - Fork 165
Contributing code changes to a pull request
Nathan Wallach edited this page Jul 20, 2018
·
2 revisions
If you need to make a new pull request you should read: https://github.com/openwebwork/webwork2/wiki/Creating-Pull-Requests and not this page.
This page is to guide you through the process of submitting proposed changes to someone else's pull request, when you do not have maintainer (push) access to the main repository.
This is a draft
Below we assume the PR is for webwork2
but the same approach with suitable changes should work for other repositories.
- Stage 1: You will download the git branch of the PR, make the changes there, and the push them into your own (forked) GitHub repository.
-
Find the pull number and replace
800
below by the pull number you need. -
Use one of the following methods to get the code of the PR in your local git.
-
Method 1: download the pull request branch from the pull request author's webwork2 repository.
- Replace
BranchName
below by the BranchName used by the author of the PR. - Replace
myGithubUser
below by your github account. - replace
prAuthor
by the github username of the author of the PR. - If you (want to) call your remote repo something other then
personal
change it below.
- Replace
git checkout -b BranchName origin/develop # get a fresh copy of develop as BranchName
git branch # switch to BranchName
# Get the pull request branch from the author's repo:
git pull https://github.com/prAuthor/webwork2 BranchName
# Make your changes and "git commit" them locally
# If you did not yet do this yet, then do it now:
# git remote add personal https://github.com/myGithubUser/webwork2.git
git push personal BranchName
-
Method 2: download the pull request branch from the main webwork2 repository.
- Replace
BranchName
below by the BranchName used by the author of the PR. - Replace
myGithubUser
below by your github account. - Find the pull number and replace
800
below by the pull number you need. - If you (want to) call your remote repo something other then
personal
change it below.
- Replace
git fetch origin pull/800/head:BranchName
git checkout BranchName
# Make your changes and "git commit" them locally
# If you did not yet do this yet, then do it now:
# git remote add personal https://github.com/myGithubUser/webwork2.git
git push personal BranchName
- Stage 2: You create a pull request on GitHub from the branch you just created into the PR author's branch.
- These instructions are to make a PR to some else's existing PR, which is why you will me making a PR to the relevant branch of their repository and not to the main openwebwork repository.
- Navigate to
https://github.com/taniwallach/webwork2/tree/BranchName
to the branch you just pushed to your personal GitHub repo. - Click the
New Pull Request
button. - Change the base fork (on the left) to the repo of the author of the PR, and then the base to the
BranchName
(the name of the branch related to this PR). - If all is well, you should see Able to merge in green. (If not, more careful work may be needed, but you should still be able to create the Pull request to the main PR author.)
- Write a comment in the box.
- Click the Create Pull Request button.
- Wait for the PR author to review your request. If it is approved it will get merged into the main PR.