git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to create v2 patch
@ 2007-12-01 12:41 Tilman Schmidt
  2007-12-01 13:17 ` Pascal Obry
  2007-12-01 14:02 ` Jakub Narebski
  0 siblings, 2 replies; 10+ messages in thread
From: Tilman Schmidt @ 2007-12-01 12:41 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Let's say that following the scheme laid out in
http://www.kernel.org/pub/software/scm/git/docs/everyday.html#Individual%20Developer%20(Participant)
I have produced a patch, submitted it to LKML, received a few
comments, committed appropriate changes to my local git tree,
and now want to submit a revised patch. How do I do that?
If I just run git-format-patch again, it produces my original
patch plus a second one containing my updates, but what I need
is a single new patch replacing the first one.

Thanks,
Tilman

-- 
Tilman Schmidt                          E-Mail: tilman@imap.cc
Bonn, Germany
Yes, I have searched Google!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-01 12:41 how to create v2 patch Tilman Schmidt
@ 2007-12-01 13:17 ` Pascal Obry
  2007-12-01 13:43   ` Mike Hommey
  2007-12-01 14:02 ` Jakub Narebski
  1 sibling, 1 reply; 10+ messages in thread
From: Pascal Obry @ 2007-12-01 13:17 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: git

Tilman Schmidt a écrit :
> Let's say that following the scheme laid out in
> http://www.kernel.org/pub/software/scm/git/docs/everyday.html#Individual%20Developer%20(Participant)
> I have produced a patch, submitted it to LKML, received a few
> comments, committed appropriate changes to my local git tree,
> and now want to submit a revised patch. How do I do that?
> If I just run git-format-patch again, it produces my original
> patch plus a second one containing my updates, but what I need
> is a single new patch replacing the first one.

Can't you merge both of your changes in your local repository? I would
do that with an interactive rebase.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-01 13:17 ` Pascal Obry
@ 2007-12-01 13:43   ` Mike Hommey
  2007-12-06 20:04     ` Tilman Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Hommey @ 2007-12-01 13:43 UTC (permalink / raw)
  To: Pascal Obry; +Cc: Tilman Schmidt, git

On Sat, Dec 01, 2007 at 02:17:39PM +0100, Pascal Obry wrote:
> Tilman Schmidt a écrit :
> > Let's say that following the scheme laid out in
> > http://www.kernel.org/pub/software/scm/git/docs/everyday.html#Individual%20Developer%20(Participant)
> > I have produced a patch, submitted it to LKML, received a few
> > comments, committed appropriate changes to my local git tree,
> > and now want to submit a revised patch. How do I do that?
> > If I just run git-format-patch again, it produces my original
> > patch plus a second one containing my updates, but what I need
> > is a single new patch replacing the first one.
> 
> Can't you merge both of your changes in your local repository? I would
> do that with an interactive rebase.

Or just git commit --amend when committing.

Mike

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-01 12:41 how to create v2 patch Tilman Schmidt
  2007-12-01 13:17 ` Pascal Obry
@ 2007-12-01 14:02 ` Jakub Narebski
  2007-12-01 14:14   ` Björn Steinbrink
  1 sibling, 1 reply; 10+ messages in thread
From: Jakub Narebski @ 2007-12-01 14:02 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: git

Tilman Schmidt <tilman@imap.cc> writes:

> Let's say that following the scheme laid out in
> "Everyday GIT ...", chapter "Individual Developer (Participant)".
> I have produced a patch, submitted it to LKML, received a few
> comments, committed appropriate changes to my local git tree,
> and now want to submit a revised patch. How do I do that?

If you have original commit and commit with corrections on top of it,
do a squash rebase using "git rebase -i" (interactive), or do a squash
merge.

In the future it would be better to just amend ("git commit --amend")
original commit (or if you are using StGIT, "stg refresh" it).

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-01 14:02 ` Jakub Narebski
@ 2007-12-01 14:14   ` Björn Steinbrink
  0 siblings, 0 replies; 10+ messages in thread
From: Björn Steinbrink @ 2007-12-01 14:14 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Tilman Schmidt, git

On 2007.12.01 06:02:23 -0800, Jakub Narebski wrote:
> Tilman Schmidt <tilman@imap.cc> writes:
> 
> > Let's say that following the scheme laid out in
> > "Everyday GIT ...", chapter "Individual Developer (Participant)".
> > I have produced a patch, submitted it to LKML, received a few
> > comments, committed appropriate changes to my local git tree,
> > and now want to submit a revised patch. How do I do that?
> 
> If you have original commit and commit with corrections on top of it,
> do a squash rebase using "git rebase -i" (interactive), or do a squash
> merge.
> 
> In the future it would be better to just amend ("git commit --amend")
> original commit (or if you are using StGIT, "stg refresh" it).

For completeness:
To use "git commit --amend" for any but the latest commit, you use
rebase -i, too. Just change the "pick" for the commit you want to amend
to "edit". Rebasing will stop _after_ applying that commit and you can
amend it.

Björn

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-01 13:43   ` Mike Hommey
@ 2007-12-06 20:04     ` Tilman Schmidt
  2007-12-06 20:44       ` Jan Hudec
                         ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tilman Schmidt @ 2007-12-06 20:04 UTC (permalink / raw)
  To: Mike Hommey; +Cc: Pascal Obry, git

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

Am 01.12.2007 14:43 schrieb Mike Hommey:
> On Sat, Dec 01, 2007 at 02:17:39PM +0100, Pascal Obry wrote:
>> Tilman Schmidt a écrit :
>>> I have produced a patch, submitted it to LKML, received a few
>>> comments, committed appropriate changes to my local git tree,
>>> and now want to submit a revised patch. How do I do that?
>>> If I just run git-format-patch again, it produces my original
>>> patch plus a second one containing my updates, but what I need
>>> is a single new patch replacing the first one.
>> Can't you merge both of your changes in your local repository? I would
>> do that with an interactive rebase.
> 
> Or just git commit --amend when committing.

Hmm. But wouldn't each of these approaches lead to my original
commit being removed from my git repository? And isn't removing
commits that have already been published strongly discouraged?

Thx
T.

-- 
Tilman Schmidt                          E-Mail: tilman@imap.cc
Bonn, Germany
Yes, I have searched Google!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-06 20:04     ` Tilman Schmidt
@ 2007-12-06 20:44       ` Jan Hudec
  2007-12-06 21:38       ` Pascal Obry
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Jan Hudec @ 2007-12-06 20:44 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: Mike Hommey, Pascal Obry, git

On Thu, Dec 06, 2007 at 21:04:38 +0100, Tilman Schmidt wrote:
> Am 01.12.2007 14:43 schrieb Mike Hommey:
> > On Sat, Dec 01, 2007 at 02:17:39PM +0100, Pascal Obry wrote:
> >> Tilman Schmidt a écrit :
> >>> I have produced a patch, submitted it to LKML, received a few
> >>> comments, committed appropriate changes to my local git tree,
> >>> and now want to submit a revised patch. How do I do that?
> >>> If I just run git-format-patch again, it produces my original
> >>> patch plus a second one containing my updates, but what I need
> >>> is a single new patch replacing the first one.
> >> Can't you merge both of your changes in your local repository? I would
> >> do that with an interactive rebase.
> > 
> > Or just git commit --amend when committing.
> 
> Hmm. But wouldn't each of these approaches lead to my original
> commit being removed from my git repository? And isn't removing
> commits that have already been published strongly discouraged?

Removing commits that you already published is strongly discouraged. But
patch is not a commit. A v2 (short for 'second version') patch means a patch,
that should be applied /instead/ of the previous. The previous patch -- and
the commit it was generated from as well as any commit generated by applying
it -- should indeed be replaced by the new version.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-06 20:04     ` Tilman Schmidt
  2007-12-06 20:44       ` Jan Hudec
@ 2007-12-06 21:38       ` Pascal Obry
  2007-12-06 22:03       ` Andreas Ericsson
  2007-12-07  8:11       ` Wincent Colaiuta
  3 siblings, 0 replies; 10+ messages in thread
From: Pascal Obry @ 2007-12-06 21:38 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: Mike Hommey, git

Tilman Schmidt a écrit :
> Hmm. But wouldn't each of these approaches lead to my original
> commit being removed from my git repository? And isn't removing
> commits that have already been published strongly discouraged?

They won't be removed, just changed/merged... and that's what you were
looking for or I did not understand your question! This is not bad
practice as it is done on YOUR repository. Of course this should never
be done on a pushed/published changeset.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-06 20:04     ` Tilman Schmidt
  2007-12-06 20:44       ` Jan Hudec
  2007-12-06 21:38       ` Pascal Obry
@ 2007-12-06 22:03       ` Andreas Ericsson
  2007-12-07  8:11       ` Wincent Colaiuta
  3 siblings, 0 replies; 10+ messages in thread
From: Andreas Ericsson @ 2007-12-06 22:03 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: Mike Hommey, Pascal Obry, git

Tilman Schmidt wrote:
> Am 01.12.2007 14:43 schrieb Mike Hommey:
>> On Sat, Dec 01, 2007 at 02:17:39PM +0100, Pascal Obry wrote:
>>> Tilman Schmidt a écrit :
>>>> I have produced a patch, submitted it to LKML, received a few
>>>> comments, committed appropriate changes to my local git tree,
>>>> and now want to submit a revised patch. How do I do that?
>>>> If I just run git-format-patch again, it produces my original
>>>> patch plus a second one containing my updates, but what I need
>>>> is a single new patch replacing the first one.
>>> Can't you merge both of your changes in your local repository? I would
>>> do that with an interactive rebase.
>> Or just git commit --amend when committing.
> 
> Hmm. But wouldn't each of these approaches lead to my original
> commit being removed from my git repository? And isn't removing
> commits that have already been published strongly discouraged?
> 

The term "published" means different things for different projects.
For the Linux kernel, "published" is when your commit ends up in a
repository that Linus pulls from.

So long as you're getting suggestions to fix up your patch, it's
safe to assume it hasn't been accepted into one of those repos, and
you can safely --amend the offending commit(s).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: how to create v2 patch
  2007-12-06 20:04     ` Tilman Schmidt
                         ` (2 preceding siblings ...)
  2007-12-06 22:03       ` Andreas Ericsson
@ 2007-12-07  8:11       ` Wincent Colaiuta
  3 siblings, 0 replies; 10+ messages in thread
From: Wincent Colaiuta @ 2007-12-07  8:11 UTC (permalink / raw)
  To: Tilman Schmidt; +Cc: Mike Hommey, Pascal Obry, git

El 6/12/2007, a las 21:04, Tilman Schmidt escribió:

> Am 01.12.2007 14:43 schrieb Mike Hommey:
>> On Sat, Dec 01, 2007 at 02:17:39PM +0100, Pascal Obry wrote:
>>> Tilman Schmidt a écrit :
>>>> I have produced a patch, submitted it to LKML, received a few
>>>> comments, committed appropriate changes to my local git tree,
>>>> and now want to submit a revised patch. How do I do that?
>>>> If I just run git-format-patch again, it produces my original
>>>> patch plus a second one containing my updates, but what I need
>>>> is a single new patch replacing the first one.
>>> Can't you merge both of your changes in your local repository? I  
>>> would
>>> do that with an interactive rebase.
>>
>> Or just git commit --amend when committing.
>
> Hmm. But wouldn't each of these approaches lead to my original
> commit being removed from my git repository?

Not immediately, but eventually. Let's say you have a history like this:

A--B--C--D

And you amend commit D to become D':

A--B--C--D'
        \
         D

You effectively have two "branches" now, but one of them (the original  
D) is unreferenced and will eventually be garbage collected. In other  
words, your ongoing development will look like this:

A--B--C--D'-E--F--G
        \
         D

At this point the only thing which references commit D will be your  
reflog, and with default settings that means that the commit will hang  
around for at least 90 more days before being pruned during garbage  
collection.

> And isn't removing
> commits that have already been published strongly discouraged?

Yes, normally that statement is true (because someone else may have  
based work on top of "D" and if you delete "D" then you just pulled  
the rug out from under them). But as others have pointed out, posting  
a PATCH to a mailing list isn't the same thing as "publishing a  
commit", so I won't repeat what's already been explained.

If, however, you really had *published* the commit (ie. pushed it out  
to an accessible repository) then you'd want to use "git revert"  
rather than "git commit --amend".

A--B--C--D--D'--E--F

Reverting doesn't delete any commits at all; instead it introduces a  
new commit (D') which undoes the change introduced in D. So you're  
undoing the *effect* of D without actually "undoing" the fact that you  
committed and published it.

Cheers,
Wincent

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-12-07  8:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-01 12:41 how to create v2 patch Tilman Schmidt
2007-12-01 13:17 ` Pascal Obry
2007-12-01 13:43   ` Mike Hommey
2007-12-06 20:04     ` Tilman Schmidt
2007-12-06 20:44       ` Jan Hudec
2007-12-06 21:38       ` Pascal Obry
2007-12-06 22:03       ` Andreas Ericsson
2007-12-07  8:11       ` Wincent Colaiuta
2007-12-01 14:02 ` Jakub Narebski
2007-12-01 14:14   ` Björn Steinbrink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).