These are the steps that Mr. Greg Nutt used to follow to apply a received Pull Request. So this post is basically an extension of the steps that he shared with me. I’m documenting it here because it could be useful for some committer until we get the new NuttX Workflow in place.
- First review the change. If it looks risky, ask for other,
appropriate people to review the change too.
- Wait for other review comments if you have requested them. You may need to ask the contributor to fix certain things and force push an update.
- When you are satisfied, you can follow these steps.
First you need to clone the nuttx and apps repositories:
$ git clone https://github.com/apache/incubator-nuttx nuttx
$ git clone https://github.com/apache/incubator-apps apps
Enter inside nuttx and create a prXX branch, in this case the XX is the pull request number received at github. Then for pull request #26 it will be pr26.
$ cd nuttx $ git branch pr26 $ git checkout pr26 $ git push -u origin pr26
This last command submitted your branch to github repository.
Now you can go to the github pull request page (https://github.com/apache/incubator-nuttx/pull/XX where XX is the PR #) and merge it into this new branch.
To do it click on Edit button in the top of the page, at right side of the PR name:
Click on “base:master” below the textbox:
Change it to prXX (i.e. pr26) that you just created:
It will ask if you want to change base, just confirm:
Now scroll to the bottom of the page. You will see a big green “Merge pull request” button. Use the little arrow pull-down and select “Squash and Merge”:
Click on “Squash and Merge” button. It will allow to edit the Pull Request comments. When everything is fine click on “Confirm squash and merge”:
Return to the Linux terminal and update the prXX branch to get the commits from the received Pull Request:
$ git pull origin pr26
At this point you should have all modified files in your local repository. It is time to modify the “review.sh” to include the files to be reviewed.
You can run this command to get the list of the modified files:
$ git show --name-only
Copy these files (only include files with .c and .h extension) to the FILELIST=”\ inside the “review.sh”. Don’t forget to remove the old file names inside this FILELIST variable.
After including the file names inside “review.sh”, save and exist the editor and run this command:
Fix any reported error and run the ./review.sh again until everything is fixed.
When everything is fine you need to add the modified files and amend:
$ git add path/to/modified/file.c $ git commit --amend
Then return to master branch:
$ git checkout master
Update the master again before doing the merge:
$ git pull --rebase
Now you can commit these modifications, but remember to commit using using the original PR# Author:
$ git commit -a --author="Original Author PR <firstname.lastname@example.org"
Remember to edit the commit to make it clear, remove not important field comments, look other commits for reference.
Send these modification to git repository:
$ git push origin master
Finally you can remove the prXX branch, local and from repository:
$ git branch -D pr26
$ git push --delete origin pr26