Skip to content

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

Open

Description

@LfxB

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions