开发者

Github: Merge commits during pull requests

I have a fork of a project which I am contributing to. Currently, I have an open pull request from a branch on my fork (the master is clean, as in a duplicate of the original repository's master). So far no problems.

Now the original author pushed some new commits which I want to integrate into my branch (as those commits were made to aid my work on that branch). Is there a better way than to simply pull them into my fork and merge them with my branch?

I understand that rebasing isn't possible (or at least should be avoided), given that I am already using the commits for the pull request, and I really don't want to mess anything up (not for me, but also not for the original project author, given that he needs to merge in my changes at well at some later point).

So what I would do now is:

git pull upstream
git checkout mybranch
git merge master
git push

Is th开发者_如何学编程at the best way to do it?


Actually, if nothing has been pulled from your branch yet, rebasing is still an option. I believe GitHub is intelligent enough to deal with rebases in pull requests (it's looking at the branch, iirc).

That said, a merge workflow is also an option. You could do it with the commands you have in your question, or if you don't want to be swapping branches around, you could do it with just the following:

git checkout mybranch
git pull upstream master
git push
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜