You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datafu.apache.org by Matthew Hayes <ma...@gmail.com> on 2014/01/17 00:00:14 UTC

how to create and apply a patch with git

I wanted to share a link to this blog post that Jakob shared on the Samza
dev mailing list:

http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/

Quoting Jakob:

> Two benefits over the current, svn-style patches:
> 1) The patches include the author, who is credit in the commit log (I've
> been doing this manually, but it's a pain)
> 2) The patch application and commit happens as a single step, helping to
> avoid dunce-level errors like mine from yesterday.
>
> Thoughts on this?  Josh is this the practice you all follow in Apache
Crunch?

If people agree we should add these instructions to the website for those
who want to contribute.

-Matt

Re: how to create and apply a patch with git

Posted by Matthew Hayes <ma...@gmail.com>.
I think if the committer does the squashing they should keep the author.  I
tried an experiment where I took a patching having multiple commits and
squashed them into another branch. This then seems to work fine:

git commit --author "Some Name <au...@somewhere.com>" -m "This commit has
lots of changes"

It's definitely nice having a single commit instead of having all the
intermediate commits interspersed.  This would be a good policy to follow.

On Thu, Jan 16, 2014 at 5:03 PM, Jakob Homan <jg...@gmail.com> wrote:

> Yeah, that's the same thing I found as well and the process I mentioned
> above.  It'll certainly work.  Chris and I had talked about some script to
> automate the process, since the whole point is to make it easy to give
> credit to the contributors, who may or may not be familiar with the patch
> process.
>
> I like the process, just wish it could do the squash automatically.
>
> I'm not sure if the committer doing the squashing would still keep the
> author? Maybe.
>
>
> On Thu, Jan 16, 2014 at 4:37 PM, Matthew Hayes <
> matthew.terence.hayes@gmail.com> wrote:
>
> > What if the person creating the patch uses a throwaway branch like below
> if
> > there are multiple commits?  Otherwise the one committing the patch could
> > squash themselves but they'd have to write the commit message.
> >
> >
> >
> http://stackoverflow.com/questions/616556/how-do-you-squash-commits-into-one-patch-with-git-format-patch
> >
> >
> > On Thu, Jan 16, 2014 at 3:28 PM, Jakob Homan <jg...@gmail.com> wrote:
> >
> > > We haven't actually done this quite yet for one reason.  It turns out
> > that
> > > when you have multiple commits, this method replays those commits
> against
> > > the repo you're patching, ie your intermediate commits show up too.
>  This
> > > may or may not be what people want; generally I just want the final
> > version
> > > of the patch to be applied.
> > >
> > > I looked around and couldn't find a way to automatically squash the
> > commits
> > > as part of this process, so if one wants to do that squashing, it must
> be
> > > done manually.
> > >
> > > Otherwise, and for single commit patches, this works well.
> > > -jg
> > >
> > >
> > >
> > > On Thu, Jan 16, 2014 at 3:00 PM, Matthew Hayes <
> > > matthew.terence.hayes@gmail.com> wrote:
> > >
> > > > I wanted to share a link to this blog post that Jakob shared on the
> > Samza
> > > > dev mailing list:
> > > >
> > > >
> > http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
> > > >
> > > > Quoting Jakob:
> > > >
> > > > > Two benefits over the current, svn-style patches:
> > > > > 1) The patches include the author, who is credit in the commit log
> > > (I've
> > > > > been doing this manually, but it's a pain)
> > > > > 2) The patch application and commit happens as a single step,
> helping
> > > to
> > > > > avoid dunce-level errors like mine from yesterday.
> > > > >
> > > > > Thoughts on this?  Josh is this the practice you all follow in
> Apache
> > > > Crunch?
> > > >
> > > > If people agree we should add these instructions to the website for
> > those
> > > > who want to contribute.
> > > >
> > > > -Matt
> > > >
> > >
> >
>

Re: how to create and apply a patch with git

Posted by Jakob Homan <jg...@gmail.com>.
Yeah, that's the same thing I found as well and the process I mentioned
above.  It'll certainly work.  Chris and I had talked about some script to
automate the process, since the whole point is to make it easy to give
credit to the contributors, who may or may not be familiar with the patch
process.

I like the process, just wish it could do the squash automatically.

I'm not sure if the committer doing the squashing would still keep the
author? Maybe.


On Thu, Jan 16, 2014 at 4:37 PM, Matthew Hayes <
matthew.terence.hayes@gmail.com> wrote:

> What if the person creating the patch uses a throwaway branch like below if
> there are multiple commits?  Otherwise the one committing the patch could
> squash themselves but they'd have to write the commit message.
>
>
> http://stackoverflow.com/questions/616556/how-do-you-squash-commits-into-one-patch-with-git-format-patch
>
>
> On Thu, Jan 16, 2014 at 3:28 PM, Jakob Homan <jg...@gmail.com> wrote:
>
> > We haven't actually done this quite yet for one reason.  It turns out
> that
> > when you have multiple commits, this method replays those commits against
> > the repo you're patching, ie your intermediate commits show up too.  This
> > may or may not be what people want; generally I just want the final
> version
> > of the patch to be applied.
> >
> > I looked around and couldn't find a way to automatically squash the
> commits
> > as part of this process, so if one wants to do that squashing, it must be
> > done manually.
> >
> > Otherwise, and for single commit patches, this works well.
> > -jg
> >
> >
> >
> > On Thu, Jan 16, 2014 at 3:00 PM, Matthew Hayes <
> > matthew.terence.hayes@gmail.com> wrote:
> >
> > > I wanted to share a link to this blog post that Jakob shared on the
> Samza
> > > dev mailing list:
> > >
> > >
> http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
> > >
> > > Quoting Jakob:
> > >
> > > > Two benefits over the current, svn-style patches:
> > > > 1) The patches include the author, who is credit in the commit log
> > (I've
> > > > been doing this manually, but it's a pain)
> > > > 2) The patch application and commit happens as a single step, helping
> > to
> > > > avoid dunce-level errors like mine from yesterday.
> > > >
> > > > Thoughts on this?  Josh is this the practice you all follow in Apache
> > > Crunch?
> > >
> > > If people agree we should add these instructions to the website for
> those
> > > who want to contribute.
> > >
> > > -Matt
> > >
> >
>

Re: how to create and apply a patch with git

Posted by Matthew Hayes <ma...@gmail.com>.
What if the person creating the patch uses a throwaway branch like below if
there are multiple commits?  Otherwise the one committing the patch could
squash themselves but they'd have to write the commit message.

http://stackoverflow.com/questions/616556/how-do-you-squash-commits-into-one-patch-with-git-format-patch


On Thu, Jan 16, 2014 at 3:28 PM, Jakob Homan <jg...@gmail.com> wrote:

> We haven't actually done this quite yet for one reason.  It turns out that
> when you have multiple commits, this method replays those commits against
> the repo you're patching, ie your intermediate commits show up too.  This
> may or may not be what people want; generally I just want the final version
> of the patch to be applied.
>
> I looked around and couldn't find a way to automatically squash the commits
> as part of this process, so if one wants to do that squashing, it must be
> done manually.
>
> Otherwise, and for single commit patches, this works well.
> -jg
>
>
>
> On Thu, Jan 16, 2014 at 3:00 PM, Matthew Hayes <
> matthew.terence.hayes@gmail.com> wrote:
>
> > I wanted to share a link to this blog post that Jakob shared on the Samza
> > dev mailing list:
> >
> > http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
> >
> > Quoting Jakob:
> >
> > > Two benefits over the current, svn-style patches:
> > > 1) The patches include the author, who is credit in the commit log
> (I've
> > > been doing this manually, but it's a pain)
> > > 2) The patch application and commit happens as a single step, helping
> to
> > > avoid dunce-level errors like mine from yesterday.
> > >
> > > Thoughts on this?  Josh is this the practice you all follow in Apache
> > Crunch?
> >
> > If people agree we should add these instructions to the website for those
> > who want to contribute.
> >
> > -Matt
> >
>

Re: how to create and apply a patch with git

Posted by Jakob Homan <jg...@gmail.com>.
We haven't actually done this quite yet for one reason.  It turns out that
when you have multiple commits, this method replays those commits against
the repo you're patching, ie your intermediate commits show up too.  This
may or may not be what people want; generally I just want the final version
of the patch to be applied.

I looked around and couldn't find a way to automatically squash the commits
as part of this process, so if one wants to do that squashing, it must be
done manually.

Otherwise, and for single commit patches, this works well.
-jg



On Thu, Jan 16, 2014 at 3:00 PM, Matthew Hayes <
matthew.terence.hayes@gmail.com> wrote:

> I wanted to share a link to this blog post that Jakob shared on the Samza
> dev mailing list:
>
> http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
>
> Quoting Jakob:
>
> > Two benefits over the current, svn-style patches:
> > 1) The patches include the author, who is credit in the commit log (I've
> > been doing this manually, but it's a pain)
> > 2) The patch application and commit happens as a single step, helping to
> > avoid dunce-level errors like mine from yesterday.
> >
> > Thoughts on this?  Josh is this the practice you all follow in Apache
> Crunch?
>
> If people agree we should add these instructions to the website for those
> who want to contribute.
>
> -Matt
>