A while back, GitHub added a setting for contributors to allow maintainers of a repo to push changes to a pull request branch of their fork. I've been doing a lot more work in GitHub recently and figured I'd document my Git process for handling pull requests where you just want to close up a couple small things in a given time frame and/or the originator isn't very responsive. IMO this makes it much easier to retain the commit history giving credit to the other person but still move existing PRs forward.
The essence of my process is to add their fork as a remote, switch to that branch, do stuff and commit, and then push to it. It's not really a whole lot, but I've found that very specific snippets come in very handy, even if they're short and straight-forward. I also don't like the instructions GitHub gives for making changes to a fork's branch. So, that gives us (using a real recent example):
If you use hub (I don't), I believe you can skip the first command as fetch will add the remote for you if it's not recognized. There's also the popular Git Extras, which has a pr command, but from what I've tested it doesn't use the actual remote branch the PR originates from even if you specify the remote, but rather the pulls/### branch GitHub makes for you. If you use (or decide to write) a Git helper that does the remote adding/fetching/checkout for you (e.g. git pr KZeni/patch-1 or even making it so that git pr ### could detect the remote fork and branch for that PR), let me know!

Leave a Reply