In case of any collaborated project (eg. linux-kernel), often after submitting a patch for review, we often receive several comments and need to make appropriate changes and generate a new "version2" of the patch containing the changes. If we are using Git for revision control, then the entire process becomes a snap.
How to prepare a modified patch for resend in 5 easy steps:
git rebase -i <commit-id-just-before-our-changes>
As discussed in the review, make the new changes to the source-files.
git add <modified-filenames>
git commit --amend
(shows editor with original commit-msg)
Edit the commit-msg (or leave as-is) and quit.
New commit is generated in the place of old commit.
git format-patch HEAD~1
DONE!! New patch version2 is ready for review now. :-)
If we do a diff between the PREV and NEW patch, we can see :
+ Changes made after review.
+ Time-Stamp change.
+ Hash change.