首选Github工作流程,用于在代码审查后更新拉取请求 [英] Preferred Github workflow for updating a pull request after code review
问题描述
我已经向Github上的开源项目提交了一个更改,并收到了其中一位核心团队成员的代码审查意见。
我想更新代码考虑了审查意见,并重新提交。这样做的最佳工作流程是什么?从我有限的git / github知识中,我可以执行以下任何操作:
-
将代码更新为新提交,并将最初和更新的提交添加到我的pull请求中。
不知何故(??)从我的存储库回滚旧的提交,并创建一个新的提交包含一切,然后提出一个拉请求? -
git commit
有一个修改功能,但我听说你在本地仓库之外推送提交之后不应该使用它?在这种情况下,我在本地PC上进行了更改,并将其推送到项目的github分支。这可以使用'修改'吗? -
其他?
看起来选项2/3会很好,因为开源项目在他们的历史中只会有一个实现所有事情的提交,但我不确定如何执行此操作。注意:我不知道这是否会影响答案,但我没有在单独的分支中进行更改,我只是在主控之上做了一个提交
只需在提交请求中使用的分支添加一个新的提交,并将分支推送到GitHub。拉取请求将自动更新,并附加提交。
#2和#3是不必要的。如果人们只想看到你的分支在哪里被合并(而不是附加提交),他们可以使用 git log --first-parent
来仅查看合并提交日志。
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 commit
has 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-parent
to only view the merge commit in the log.
这篇关于首选Github工作流程,用于在代码审查后更新拉取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!