github / github/gh-stack

Feature Request: Add `gh stack split` to split the current branch at a chosen commit

Open
#508 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
70
Avg merge
1d 8h
Merged PRs (30d)
7

Description

## Problem
A branch often grows into two or more reviewable concerns, splitting these after the fact is tedious
Today it requires a manual operation: insert 1 PR above, cherry pick commits from PR1 to new PR2, rebase
If more than 1 split is required, it's even more error prone manipulations

## Proposal

`gh stack split [] [--at ]`

- Current branch keeps commits up to ``
- `` and commits above move to ``, inserted **directly above** the current branch in the stack (if some PR are already stacked above current PR)
- Branches already above are rebased onto the new layer; existing PRs keep their identity, the current PR's base is unchanged

Ideally, interactive mode lists the current branch's commits, user picks the split point and types the new branch name: this could happen in the `gh stack modify` view

Contributor guide

Open the contributing guide

Research direction

Start with the existing gh stack command entry point and the gh stack modify view, since the proposal suggests integrating interactive split selection there. Define the split behavior for the current branch, branches already above it, and pull-request identity, then verify that gh stack split supports the named branch and commit options and preserves the stated stack relationships.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github, go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.