I have a series of commits in a fork that I want to apply or reject one at a time to my fork. Should I use git cherry-pick for this?
Yes. git cherry-pick COMMIT_SHA
will allow you to grab a specific commit. You don't need to reject commits, though; just don't cherry pick them.
I'd use an interactive rebase for this:
git rebase -i master fork-branch
When git asks what you want to do with each of the commits, tell it edit for all of them (search and replace pick -> edit). Save and quit, and the interactive rebase will go through the commits, stopping at each to let you do your thing. Do your testing, decide if you want to keep it. If you do, just run git rebase --continue
to move on to the next. If you don't, run git reset --hard HEAD^
to reset to the previous commit, throwing away the one you don't want, then move on to git rebase --continue
.
If there are commits you know right away you don't want, you can just remove them from the list instead of changing pick to edit. And of course, if I've completely misunderstood, and you don't need to do any testing, then you can pretty much disregard the previous paragraph, and do it all by selectively removing lines.