When I add a file to staging, I can
$ git add my_file -p
And select the chunks I want to stage.
Is there a way to merge/cherry-pick a commit and apply its diff chunk by chunk?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not aware of a direct way to do this but here’s an indirect way.
git cherry-pick -n <commit>Cherry pick the commit but tell git not to commit it (
-n). The changes should now be in your working copy so you can dogit checkout -pThis will iterate over each chunk and ask if you want to discard it, say yes to any chunks you don’t want and no to chunks you want to keep.