Does a number of commits with cherry picks select or rebase -onto with the same result?

Sometimes I want to select a series of commits from another repository. I know two ways to do this.

1.

git checkout myBranch
git cherry-pick begin..end

or

  1. git rebase --onto myBranch begin end

I find the first version easier to remember. However, I read a lot about how throwing cherries is evil compared to merging because it destroys the story a bit. But I still haven't figured out if there is a difference between a cherry picking a range of commits or reloading them with--onto

I tend to think that there should be no difference. Am I mistaken?

+5
source share
3 answers

These two commands are equivalent, you just do the work that the normal rebase will do to find out if the commit worked to transfer to the target branch.

+1

Rebasing cherry-picking "" . ; .

+1

Actually, cherry picking is less vicious in this respect than rebalancing. Choosing a cherry will create duplicate commits, while reloading will actually move them (thus rewriting the story).

Both are more evil than merging, which in my honest opinion is usually the worst choice.

-2
source

All Articles