unstack
Transform linear commit histories into parallel branches for separate pull requests. Organize sequential changes into independent branches that can be reviewed and merged individually.
Instructions
Unstack linear commits into parallel branches for separate PRs.
This tool transforms a linear commit history (A -> B -> C -> D) into parallel branches (A -> B, A -> C, A -> D) where each branch contains specific commits cherry-picked from the original history.
Use this when you've made multiple changes in sequence but want to create separate PRs for different logical changes. Each branch can be independently reviewed and merged.
Example scenario: You have commits: fix-bug -> add-feature -> update-docs You want separate PRs, so you create:
feat/999: [fix-bug, update-docs]
feat/1000: [add-feature]
This creates two branches from origin/main:
feat/999 with fix-bug and update-docs cherry-picked in order
feat/1000 with add-feature cherry-picked
Args: branches: Dictionary mapping branch names to lists of commit references. Commits can be specified as SHA, branch names, or symbolic refs (e.g., HEAD~2). Commits are cherry-picked in the order specified. parent: Base commit to branch from (default: "origin/main"). All branches will start from this commit.
Returns: JSON string with format: { created_branches: [{name, commits_applied, head_sha}], errors: [{branch, commit, error}], stats: {total_branches, successful_branches, failed_branches} }
Note: - Existing branches with the same name will cause an error - The current branch is not changed by this operation - Uses low-level git commands (commit-tree, update-ref) to avoid changing working directory
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branches | Yes | ||
| parent | No | origin/main |