This is essentially how I do it too... for PRs on the pure-data project it's like this:
a=<name of branch> git fetch https://github.com/pure-data/pure-data.git $a git checkout -b $a FETCH_HEAD git checkout -b tempmerge master git merge $a
If the temporary merge seems to work (or if I can fix it up so that it works) I can then merge it back into master; if I get hung up in merge problems I can delete the branches and it's as if I didn't do anything.
I started doing this when I tried to merge the memory leaks/management PR and ended up having to do a lot of conflict resolution by hand, then gave up in the middle of the process but couldn't figure out how to unwind the changes I had made to master. (There are still buts of code floating around from that, so I've also made it much harder to ever apply that PR in the future).
I think of git as a kitchen blender, very powerful when used correctly, but if you've ever started one without remembering to put the top on you will also learn of its power to spread mayhem.
cheers Miller
On Tue, Sep 11, 2018 at 02:55:15PM +0200, IOhannes m zmoelnig wrote:
On 2018-09-11 12:49, Dan Wilcox wrote:
- Testing before merging: This is possible by adding the PR author's repo as a remote and then pulling whatever branch (master or otherwise) they submitted the PR with. This allows you to essentially do a checkout of their PR branch that you can build locally.
personally, i always do a local investigation of PRs before merging them (unless the changes are trivial). so i practically never use github's "merge" button.
however, i've found that adding the PR author's repos as remotes quickly gets painful, the more PRs there are, as it adds all the branches of the PR author's repo to mine. and i tended to forget to remove them.
so i was *very* thankful when chr13m pointed me to a solution to only pull a specific PR in [1].
later i learned that there's a "git pr" command (on Debian this is shipped in the "git-extras" package; i don't know about Fedora), which does essentially the same:
e.g. to locally fetch PR#440, i just cd into my pure-data.git dir and run:
$ git pr 440
fgasdmr IOhannes
[1] https://lists.puredata.info/pipermail/pd-dev/2018-06/021591.html
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev