git-flight-rules
git-flight-rules copied to clipboard
git apply patch to the rescue (question)
Hi, I have a question: I've seen cases where a PR is really bad in terms of merging master multiple times, with commits before, in between etc. The kind of PR you want and should rebase, but it's really hard because of these merges. In this case you can generate a patch, and then apply it on a new branch, to get the exact copy of your old branch, but less messy.
Is there anything in this guide that talks about a similar method? Or should I add that in a new PR?
I don't think we have that usecase yet. I would suggest adding it in a PR! This makes sense to me.
I'd also be curious to see how to make a patch and apply it using Git, without using GitHub's concept of forking and pull requests, which are really opinionated Git maneuvers.
I actually had to do that this week. It's pretty basic: on your messed up branch, do git diff master..head > foo.patch
, then create a new branch off master and do git apply foo.patch
.
I haven't looked at how to create a pull-request for this project though.
Huh, cool. If you want to add a section on this, I'd love to see it. :)
Hey guys, just adding a +1 that I was a bit surprised that the definitive solution to contributing code seems to be "go to Github/another similar site and create a PR".
Obviously, this is by far the most common/modern method, but might be worth having something on git format-patch/am/send-email too? Those are the intended/git native tools to facilitate code sharing after all.
Edit: made a PR instead of just talking