rebase with preserve dates opt#96
Draft
skarim wants to merge 1 commit into
Draft
Conversation
Introduce an opt-in `--committer-date-is-author-date` flag (with
`--preserve-dates` alias) for `gh stack rebase`. The flag is passed
through to every underlying `git rebase` invocation in the cascade,
keeping committer dates equal to author dates so that identical content
rebased onto an identical parent produces stable SHAs. This reduces
spurious force-push notifications and noisy review timelines, especially
in deep stacks where bottom branches get re-rebased on every merge.
Git layer changes:
- Add `RebaseOpts` struct with `CommitterDateIsAuthorDate` field to
`internal/git/gitops.go`
- Update `Ops` interface, `defaultOps`, public wrappers, and
`rebaseContinueOnce`/`tryAutoResolveRebase` helpers to accept and
forward the flag
- Update `MockOps` to match the new signatures
Command layer changes:
- Register `--committer-date-is-author-date` and `--preserve-dates`
flags on the cobra command in `cmd/rebase.go`
- Add `CommitterDateIsAuthorDate` to `cascadeRebaseOpts` and thread it
to all `git.Rebase`/`git.RebaseOnto` calls in `cmd/utils.go`
- Persist the flag in `rebaseState` JSON so `--continue` resumes with
the same behavior; pass it to `RebaseContinue` and subsequent cascade
calls
- Update `internal/modify/apply.go` callers to pass zero-value
`RebaseOpts{}`
Tests:
- Update all existing mock signatures in rebase, sync, and modify tests
- Add tests for flag passthrough, `--preserve-dates` alias, state
round-trip, `--continue` flag restoration, and conflict state
persistence
Docs:
- Update flag tables and examples in README.md and
docs/src/content/docs/reference/cli.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add --committer-date-is-author-date flag to gh stack rebase
Introduce an opt-in
--committer-date-is-author-dateflag (with--preserve-datesalias) forgh stack rebase. The flag is passedthrough to every underlying
git rebaseinvocation in the cascade,keeping committer dates equal to author dates so that identical content
rebased onto an identical parent produces stable SHAs. This reduces
spurious force-push notifications and noisy review timelines, especially
in deep stacks where bottom branches get re-rebased on every merge.
Git layer changes:
RebaseOptsstruct withCommitterDateIsAuthorDatefield tointernal/git/gitops.goOpsinterface,defaultOps, public wrappers, andrebaseContinueOnce/tryAutoResolveRebasehelpers to accept andforward the flag
MockOpsto match the new signaturesCommand layer changes:
--committer-date-is-author-dateand--preserve-datesflags on the cobra command in
cmd/rebase.goCommitterDateIsAuthorDatetocascadeRebaseOptsand thread itto all
git.Rebase/git.RebaseOntocalls incmd/utils.gorebaseStateJSON so--continueresumes withthe same behavior; pass it to
RebaseContinueand subsequent cascadecalls
internal/modify/apply.gocallers to pass zero-valueRebaseOpts{}Tests:
--preserve-datesalias, stateround-trip,
--continueflag restoration, and conflict statepersistence
Docs:
docs/src/content/docs/reference/cli.md
Stack created with GitHub Stacks CLI • Give Feedback 💬