how to create v2 patch
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
Signature · 3 lines
Tilman Schmidt E-Mail: [email protected] Bonn, Germany Yes, I have searched Google!
Quoted 8 lines · Tilman Schmidt
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.
Signature · 8 lines
--|------------------------------------------------------ --| 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
Quoted 10 lines · Pascal Obry
Quoted 8 lines · Tilman Schmidt
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.
Quoted 2 lines
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
Am 01.12.2007 14:43 schrieb Mike Hommey:
Quoted 8 lines · Pascal Obry
Quoted 7 lines
Quoted 6 lines · Tilman Schmidt
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.
Quoted 4 lines
Quoted 2 lines
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.
Signature · 3 lines
Tilman Schmidt E-Mail: [email protected] Bonn, Germany Yes, I have searched Google!
Quoted 9 lines · Tilman Schmidt
Am 01.12.2007 14:43 schrieb Mike Hommey:
Quoted 8 lines · Pascal Obry
Quoted 7 lines
Quoted 6 lines · Tilman Schmidt
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
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.
Signature · 1 line
Jan 'Bulb' Hudec <[email protected]>
Quoted 3 lines · Tilman Schmidt
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.
Signature · 8 lines
--|------------------------------------------------------ --| 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
Quoted 9 lines · Tilman Schmidt
Am 01.12.2007 14:43 schrieb Mike Hommey:
Quoted 8 lines · Pascal Obry
Quoted 7 lines
Quoted 6 lines · Tilman Schmidt
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.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
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).
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 9 lines · Tilman Schmidt
Am 01.12.2007 14:43 schrieb Mike Hommey:
Quoted 8 lines · Pascal Obry
Quoted 7 lines
Quoted 6 lines · Tilman Schmidt
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.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
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'
\
DYou 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
\
DAt 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.
Quoted 2 lines
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
Quoted 5 lines · Tilman Schmidt
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).
Signature · 2 lines
Jakub Narebski Poland
Quoted 8 lines · Jakub Narebski
Quoted 5 lines · Tilman Schmidt
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?
Quoted 6 lines
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