I’ve submitted a change to an Open Source project on Github, and received code review comments from one of the core team members.
I would like to update the code taking into account the review comments, and re-submit it. What is the best workflow for doing this? From my limited knowledge of git/github, I could do any of the following:
-
Update the code as a new commit, and add both the initial and updated commit to my pull request.
-
Somehow (??) rollback the old commit from my repository, and create a single new commit containing everything, then raise a pull request for that?
-
git commithas an amend feature, but I’ve heard that you shouldn’t use it after you’ve pushed the commit outside of your local repository? In this case I have made the change on my local PC and pushed to my github branch of the project. Would this be OK to use ‘amend’? -
Something else?
It seems like option 2/3 would be nice, as the open source project would only have one commit in their history which would implement everything, but I’m not sure how to do this.
Note: I don’t know if this affects the answer or not, but I didn’t make the changes in a separate branch, I just did a commit on top of master
Just add a new commit to the branch used in the pull request and push the branch to GitHub. The pull request will automatically be updated with the additional commit.
#2 and #3 are unnecessary. If people want to see only where your branch was merged in (and not the additional commits), they can use
git log --first-parentto only view the merge commit in the log.