Take only the git commit part, click on github

I am a fan of the github project ( Slippy ). Another fork of the project ( from kageroh ) has a commit, which I want to click on the original project, but the maintainer does not want the whole commit, only part of it.

I understand that I can use interactive reloading to accept only part of the commit, but I shouldn't, because this is a commit that is already in the open repository. Is there a way to take part in the transaction, and make it pull on the original repo with copyright attribution intact? Or do I just need to copy the changes I want and put them into a new commit under my name?

+3
source share
2 answers

I think it's great to make cherries and reduce this fixation. To set the author of the commit, just use git commit --author="The Original Author <his@address>".

To give an example, if f414f3lis a 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>"
+7
source

Rewriting the history of a public branch is a bad idea, but there is nothing sacred about a single commit, which means that you cannot copy, modify and publish it on another branch.

You can simply create a new branch, coming from the lead master, the cherry-pickcommit you want to change, and then commit --amendto change it. This should save authorship.

0
source

All Articles