I am currently maintaining my first open source projects and I keep running into the same scenario.
- I get two Pull Requests within a few minutes
- Both Pull Requests look great and don’t conflict with the master branch. I want to merge them both into master.
- I merge the first Pull Request and works great.
- I go back to the second Pull Request and now there are conflicts
What I want to do is resolve the conflicts for the contributor. The conflicts are often small and not worth asking the contributor to go through the process of rebasing. The problem is, I can’t always do it in the Github online editor, and if I follow the steps laid out by Github to make the changes in terminal, I end up making my own branch, my own Pull Request, and the contributor’s Pull Request ends up getting unceremoniously closed!
I know that technically, the code is the same in the end, but it seems pretty crumby to close the Pull Request that just happens to be the one I choose to merge in second. Is there a better way to do this? Am I misunderstanding something?
I think the question I’m trying to ask is, "Can I make changes and push to a branch on a fork that came from my repository, even if it is not my fork?" That way, the Pull Request would automatically update with the resolution I created and I can pull in the changes.
I, too, have encountered this on active repos (particularly during Hacktoberfest).
To answer your question, no, you can only push to a repository that someone has explicitly given you push access to.
The fact that is a fork of your repository is only tracked for informational purposes, since I can just as easily create a fork by cloning your project and pushing to my own remote.
It’s nice of you not to want to “bother” the contributor to fix those conflicts, but they really should. That’s just how the PR model works.
Now, you could:
- Add their branch as a remote to your own working copy
- Fix conflicts
- Push your own branch
- Merge that branch
But that would seem to ‘rob’ the contributor of part of the experience, as well as a merged PR.
The bigger problem for you as a maintainer is that this does not scale. It’s fine if you have two small PRs with white-space-only conflicts, but it very quickly becomes unmanageable. So don’t get into the habit of doing that. The only exception would be an urgent/breaking/security fix that you cannot wait to merge.
Answered By – msanford