Add config option to disable stack information in PR descriptions
Problem
When using GitHub's squash-merge strategy with PR descriptions as commit messages, git-spr currently adds stack information to every PR description. This stack metadata ends up in the git commit history after merge, which is undesirable for workflows where PR descriptions should cleanly become commit messages.
Current Behavior
The formatBody function in github/githubclient/client.go always adds stack information when there's more than one PR in the stack:
func formatBody(commit git.Commit, stack []*github.PullRequest, showPrTitlesInStack bool) string {
if len(stack) <= 1 {
return strings.TrimSpace(commit.Body)
}
// ... adds stack information
}
The existing showPrTitlesInStack option only controls whether PR titles are shown in the stack section, but doesn't allow disabling the stack section entirely.
Requested Feature
Add a configuration option (e.g., showStackInBody: false) that would allow users to disable adding stack information to PR descriptions entirely, so that formatBody returns just strings.TrimSpace(commit.Body) even when multiple PRs exist in the stack.
Use Case
When using GitHub's squash-merge with "use PR description as commit message," keeping PR descriptions clean and matching commit messages provides better synchronization between git history and the PR workflow. Stack metadata is useful in the GitHub UI but problematic when it becomes part of permanent git history.
Known Workaround
The current workaround is to change GitHub repository settings to not use the PR description as the squash-merge commit message. However, this loses the benefits of keeping git commits synchronized with PR descriptions.
Contribution
I'm willing to contribute a PR implementing this feature if you'd be open to accepting it.
@dhalperi : I think we should still show the stack in the pr body, and remove it before we merge. We should be able to always do this, because there is no need to keep this info in the pr once it merges. I have updated the templates a bit recently, and this should be now be fairly easy to achieve.