gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

Support gh stack sync --preserve-dates / --committer-date-is-author-date passthrough

Open LfxB opened this issue 1 month ago • 0 comments

Feature request

Hello,

Following #34, where we can passthrough --committer-date-is-author-date to the rebase command, it would be useful to bring this flag to the gh stack sync command as well.

My current workaround is to do gh stack sync followed by gh stack rebase --committer-date-is-author-date and gh stack push. This results in two pushes, which in some projects will start two workflows/actions, with the first one ending up cancelled.

[!NOTE] The below is near-verbatim of #34

Current behavior

git rebase and git rebase --onto are called with no date flags:

  • internal/git/gitops.go — Rebase(): runSilent("rebase", base)
  • internal/git/gitops.go — RebaseOnto(): runSilent("rebase", "--onto", newBase, oldBase, branch)

Commit timestamps follow git's default rebase behavior. There is no way to pass date-related flags through gh stack sync.

Proposed behavior

Add optional flags to gh stack sync:

  • --preserve-dates — forwards --preserve-dates to the underlying git rebase calls
  • --committer-date-is-author-date — forwards --committer-date-is-author-date to the underlying git rebase calls

These should be forwarded to both Rebase() and RebaseOnto() calls throughout the cascade rebase, including --continue flows.

Use case

When rebasing stacked branches via sync, the committer date can become significantly newer than the author date, causing commits to appear out of chronological order in tools that sort by committer date. Having control over date handling during gh stack sync would keep commit history clean and consistent.

LfxB avatar Oct 29 '26 13:10 LfxB