git-flight-rules icon indicating copy to clipboard operation
git-flight-rules copied to clipboard

git apply patch to the rescue (question)

Open Dagnan opened this issue 6 years ago • 5 comments

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?

Dagnan avatar Aug 28 '18 18:08 Dagnan

I don't think we have that usecase yet. I would suggest adding it in a PR! This makes sense to me.

RichardLitt avatar Aug 29 '18 14:08 RichardLitt

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.

RichardLitt avatar Jun 19 '19 10:06 RichardLitt

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.

Dagnan avatar Jun 20 '19 15:06 Dagnan

Huh, cool. If you want to add a section on this, I'd love to see it. :)

RichardLitt avatar Jun 22 '19 07:06 RichardLitt

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

ceuk avatar Nov 28 '20 18:11 ceuk