-
Notifications
You must be signed in to change notification settings - Fork 81
[Proposal] Add --recursive option for --squashed to support Feature Branch / Task Branch workflows #119
Description
Hello @motemen, @onk, and the maintainers .
Thank you for building and maintaining this great tool — we use it extensively in our release workflow.
Problem
In teams that use a Feature Branch → Task Branch workflow with squash merging, the current --squashed option does not detect task branch PRs that were squash-merged into feature branches.
Workflow example
production ─────────────────────────────────────────── ← merge
│
staging ──────────┬──── (squash merge) ────────────────┘
│ ↑
feature/foo ──────┤ squash merge
│ ↑
├── task/foo-1 (PR #10, squash-merged into feature/foo)
└── task/foo-2 (PR #11, squash-merged into feature/foo)
- Task branches (
task/foo-1,task/foo-2) are squash-merged into a feature branch (feature/foo). - The feature branch is then squash-merged into
staging. stagingis merged intoproductionfor release.
When running git-pr-release --squashed, only the feature branch PR is listed. Task branch PRs ( #10 , #11 ) are missing from the release pull request.
Since release PRs automatically link to the listed PR numbers in their description, including task branch PRs would make it easy to trace which release PR each task branch was shipped in. Currently, only feature branch PRs have this traceability.
Technical background
--squashed uses git log --first-parent to collect commit SHAs between the production and staging branches. The --first-parent flag only walks commits made directly on the staging branch, so squash merge commits that originated from task branches (and now live inside feature branch history) are never examined.
Proposed Solution
Add a --recursive option that, when used together with --squashed, removes the --first-parent flag from the internal git log command. This allows git log to walk all commits in the diff range — including those brought in by merged feature branches — so that task branch squash merge SHAs are also searched against the GitHub API.
Configuration
| Method | Value |
|---|---|
| CLI flag | --recursive |
| Environment variable | GIT_PR_RELEASE_RECURSIVE |
| Git config | pr-release.recursive |
Behavior
--recursiveis only effective when--squashedis also enabled.- If
--recursiveis specified without--squashed, a warning is emitted and the flag is ignored. - No additional GitHub API calls are introduced. The only change is the scope of SHAs fed into the existing search query.
Usage
# Detect task branch PRs that were squash-merged into feature branches
git-pr-release --squashed --recursive