I'm a fan of a project on github (Slippy). Another fork of the project (by kageroh) has a commit that I want to push to the original project, but the maintainer doesn't want the whole commit, only part of it.
My understanding is that I could use interactive rebasing to take only part of the commit, but that I shouldn't because it's a commit that is already on a public repository. Is there a way to take part of the commit, and get it pulled to the original repo with the author's attribution intact? Or do I just have to copy the changes I want and put them into a new commit under my name?
I think it's fine to cherry-pick and reduce that commit. To set the author of the commit, just use git commit --author="The Original Author <his@address>".
To give an example, if f414f3l is the commit that you want to reduce, I would probably do the following:
# Make sure you're on the branch you want to create the new commit on:
git checkout master
# Now cherry-pick the commit, but only stage the changes:
git cherry-pick -n f414f3l
# Choose which hunks you want to unstage interactively, using the 's'
# option to split them where necessary. (Or using the 'e' option for
# complete control over what patch to unstage.)
git reset -p
# When you commit, the commit message should be preserved:
git commit --author="The Original Author <his@address>"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With