feat: cherry-pick a commit range from branch A onto a new branch C from the action bar - #362
Open
angeousta wants to merge 3 commits into
Open
Conversation
Member
|
@angeousta This feature looks interesting, yet I wonder is it important enough to reserve a space from the main action bar. Its also missing a name. This is like automation flow - sort of. The help texts need to be re-written so its easier to understand what it does. Cancel button is not working The branch picker really needs some tuning to make this functionality feel nicer. Also it would be good to be able to visualize what is going into the new branch that is created from here.
We also need a better name for this functionality IMO |
… bar with explicit commit ranges Adds a Cherry-pick action to the action bar and to the branch context menu that creates a new branch C from a base D, checks it out, and cherry-picks every commit unique to a source ref A relative to an explicit range B (B..A, oldest first, merge commits skipped). The branch context menu entry prefills source/range/base from the invoking branch.
Shows the range..source commits that will be cherry-picked directly in the dialog before submitting, with each preview row clickable to open that commit. Also cleans up leftover local-rebase conflict markers that had ended up committed in the cherry-pick range feature's files.
… new Automations menu, fix Cancel, and redesign as a bigger dialog Responds to Havunen's review comment on the cherry-pick-range PR: - Renamed the user-facing feature to "Branch extractor" (dialog title, tooltip, menu entry). Internal Rust identifiers were left as CherryPickRangePrompt/cherry_pick_range_* since they're referenced across 23 files in gitcomet-core/state/git-gix, and a full rename was judged out of proportion for this change. - Added an "Automations" action-bar button with a dropdown menu (PopoverKind::AutomationsMenu), whose first (and currently only) entry is Branch extractor. Removed the standalone action-bar button it replaces. The menu is built from a plain entry list so future automations are new entries, not new buttons. - Fixed the Cancel button: dismiss_prompt_popover's match had no arm for CherryPickRangePrompt, so it fell through the catch-all and did nothing. It now joins the CloneRepo/CreateTagPrompt/SquashPrompt group that calls close_popover. - Reworked the popover into a centered, 860px-wide dialog (matching the existing CloneRepo modal pattern) instead of a small 540px anchored popover, giving the three ref pickers, commit preview, and new "what will be created" summary (plain-language recap + a small text diagram) real room. - Rewrote the help text in plain language instead of dense A/B/D algebra; the letters now live only next to each field's label. - Minor branch-picker tuning: the branch icon stays visible whether or not a row is focused, each of the three ref inputs got a distinct, descriptive placeholder instead of the generic "branch", and the empty state reads "No matching branches or tags". Adds a regression test for the Cancel fix and a unit test for the Automations menu model; updates the existing branch-context-menu test for the renamed entry and its new OpenPopoverCentered action. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
angeousta
force-pushed
the
feat/cherry-pick-range-onto-branch
branch
from
August 18, 2026 09:25
9a38c0c to
7ca6866
Compare
Contributor
Author
|
@Havunen done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new action-bar workflow: cherry-pick a range of commits from one branch (or ref) onto a brand-new branch, created off a separate base branch, entirely from the UI — no manual
git checkout -b+git cherry-pick <range>+ conflict babysitting required.Concretely, given a source ref A, an optional older ref B on the same line of history as A, and a base branch D, this creates a new branch C off D and cherry-picks every commit in B..A (oldest first) onto it — skipping merge commits, which cherry-pick doesn't handle meaningfully as a "pick this one commit" operation.
Why
Grabbing a handful of commits from one branch and replaying them onto a fresh branch based on something else is a genuinely common Git workflow — pulling a few commits out of a stale or abandoned branch to revive them elsewhere, extracting part of someone else's work-in-progress branch to build on top of a different base, or re-basing a small slice of history onto a cleaned-up starting point. Doing this from the CLI means: figure out the right commit range yourself (
git log, eyeballing SHAs), create the branch, rungit cherry-pick <oldest>^..<newest>, and handle whatever conflicts come up one commit at a time with no preview of what's about to happen.This PR moves that entire flow into the UI: pick the source, optionally narrow it to an explicit range, pick the base branch, preview exactly which commits are about to be replayed (see "commit range preview" below) — before anything touches the repository — and confirm. That preview step in particular addresses the main risk of the CLI version of this workflow: with
git cherry-pick, you generally only find out what you actually picked after the fact (or by manually runninggit logyourself first); here you see the exact commit list up front and can back out before anything is applied.What's included
Two commits, each a complete step:
B..Aonto it oldest-first, skipping merges. Wires the new command through the state/effect layer (gitcomet-state) and the Git backend (gitcomet-git-gix), and adds an integration test suite covering the range cherry-pick behavior end-to-end.B..Aresolves to (each with its short SHA, author, and summary), so the user can visually confirm "yes, these are the N commits I meant" instead of trusting a ref/range expression blindly. Preview rows are clickable to jump to and inspect that commit directly, for a closer look before committing to the action.Relationship to other in-flight cherry-pick work
We're aware
dev(or an open branch based on it) may also be moving in the direction of a more general interactive cherry-pick / rebase-sequencer UI for replaying individual commits via the commit editor. This PR is deliberately narrower and complementary rather than overlapping: it targets the specific "take a whole range from branch A and land it as a new branch off D" workflow, driven from the action bar / branch context menu, rather than a per-commit interactive sequencer. The two don't share UI surface or files as far as we can tell, but flagging it here in case there's a preferred direction to consolidate around — happy to adjust scope based on maintainer feedback.Testing
cargo check --workspacepasses cleanly on the final state of the branch.cargo fmt --all -- --checkpasses cleanly.cargo test -p gitcomet-git-gix --test cherry_pick_integration cherry_pick_range), covering the range resolution, ancestor validation, and merge-commit skipping.cargo test -p gitcomet-state cherry_pick), including the commit-range preview.Notes for reviewers
This PR was prepared from a fork's branch that had diverged from
devfor a while, and required adapting to a picker component (BranchRefPicker) that has since been superseded upstream — the ref-selection inputs in the cherry-pick dialog now go through the currentbranch_pickerref-row infrastructure instead, following the same pattern already used bycreate_branch_from_ref_prompt.One thing worth calling out explicitly: while replaying the original commits from the source branch, several of them turned out to contain leftover, unresolved Git conflict markers in a handful of files — the residue of an unrelated local rebase on the source branch that had never been cleaned up before those commits were made. That's pre-existing content from the original branch, not something introduced while preparing this PR; it has been cleaned up as part of consolidating this history into the two commits above, so the code you're reviewing here is clean. One side effect: the first of the two commits is not independently buildable in isolation (the conflict-marker cleanup landed together with the second commit's changes) — only the branch's final state (both commits together) is guaranteed to build and pass tests. Happy to split this further or squash to a single commit if a cleaner shape is preferred for merging.