Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick merge-commits #7404

Merged
merged 3 commits into from
Feb 26, 2025
Merged

Cherry-pick merge-commits #7404

merged 3 commits into from
Feb 26, 2025

Conversation

Byron
Copy link
Collaborator

@Byron Byron commented Feb 26, 2025

Now that the 'old' code uses the new cherry-pick just for good measure, it needs to be functionally equivalent. This also means that it has to be able to cherry-pick merge commits, something which should just work.

The re-merge we can only do if it's our workspace commits, but even then a cherry-pick should be enough. One step at a time though.

Note: Doing this breaks rebase tests, so it's easier to go with bringing back the previous code. It's worth noting that Git also will merely redo merges, instead of picking them, which to my mind seems to be a correct way of doing things. Here is an example:

label onto
reset onto
pick 9006a2d one
pick 117b0ff two
label Merge-PR-1
reset onto
merge -C 428d254 Merge-PR-1 # Merge PR #1
label branch-point
pick 0808cce three
pick 67c0c1f four
pick 5d04848 five
label Merge-PR-2
reset branch-point # Merge PR #1
merge -C 9d3c988 Merge-PR-2 # Merge PR #2
label branch-point-2
pick 81091b0 six
pick 86faedf seven
pick b5c836c eight
pick f5bbb45 nine
pick 0b325e9 ten
label Merge-PR-3

reset branch-point-2 # Merge PR #2
merge -C 621bc14 Merge-PR-3 # Merge PR #3

Example taken from https://www.olivare.net/blog/2024/git-rebase-merges .

It would have the disadvantage that it won't reproduce conflict resolutions that were made to the merge commit, forcing the user to re-merge. Cherry-picking has a chance of carrying those over as well.

Fixes #7396.

Copy link

vercel bot commented Feb 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 11:09am

Copy link

vercel bot commented Feb 26, 2025

@Byron is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

Now that the 'old' code uses the new cherry-pick just for good measure,
it needs to be functionally equivalent. This also means that it has to
be able to cherry-pick merge commits, something which should just work.

The re-merge we can only do if it's our workspace commits, but even then
a cherry-pick should be enough. One step at a time though.

NOTE: this doesn't trivially work.
This reverts commit 2c685f3.
A revert is necessary because it's not working without further changes.
@Byron Byron marked this pull request as ready for review February 26, 2025 11:09
@github-actions github-actions bot added the rust Pull requests that update Rust code label Feb 26, 2025
@Byron Byron enabled auto-merge February 26, 2025 11:13
@Byron Byron merged commit c109f68 into gitbutlerapp:master Feb 26, 2025
22 of 23 checks passed
@Byron Byron deleted the fix-7396 branch February 26, 2025 11:14
@Byron Byron changed the title Cheery-pick merge-commits Cherry-pick merge-commits Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I solve: Cannot yet cherry-pick merge-commits - use rebasing for that
1 participant