Re:Git cherry-pick and revert use 3-way merge
by ecnahc515 on Friday November 10, 2023 @02:59PM
(#38223734)
Have you ever used git cherry-pick? Git rebase is if you were loop over each commit (bottom to top) and run `git cherry-pick` on each commit separately.
If you haven't used git cherry-pick, then it is basically a shortcut for `git show $REF | git apply -`, where the short cut is the simplest form of using git, you have a patch (via git show) and you want to apply it to your local checkout.
Re:Git cherry-pick and revert use 3-way merge
by dale_glass on Friday November 10, 2023 @02:57PM
(#38223707)
> "apply a commit on another branch". What does that actually mean?
Calculate the difference between the commit and its parent, and repeat that change against another branch.
So, like git log of your work over 10 days, git show each commit individually, then apply each patch that generates against the latest code.
Re:Git cherry-pick and revert use 3-way merge
by pertymcpert on Friday November 10, 2023 @02:59PM
(#38223731)
Of course it's defined, even git knows what it means because that's what cherry-pick does.
Re:Git cherry-pick and revert use 3-way merge
by recursive on Friday November 10, 2023 @05:30PM
(#38225453)
So cherry-pick is actually merge, and rebase is actually cherry-pick?
Everything is merge.
Re:Git cherry-pick and revert use 3-way merge
by pertymcpert on Tuesday November 14, 2023 @12:53PM
(#38266829)
No, cherry-pick is cherry-pick. Rebase is a composite action which includes one or more cherry-picks.
Applying a commit "on another branch" isn't really well defined in my mind. In my understanding, a commit consists of one or more parent commits, and the complete state of a tree, including the entire contents of all the files in it.
Maybe there are other ways to be confused, but all of the uncertainty has been shoved into that simple phrase "apply a commit on another branch". What does that actually mean?