feat(record): add --before flag to insert commit before current HEAD - #1663
Draft
claytonrcarter wants to merge 4 commits into
Draft
feat(record): add --before flag to insert commit before current HEAD#1663claytonrcarter wants to merge 4 commits into
claytonrcarter wants to merge 4 commits into
Conversation
This was referenced May 19, 2026
claytonrcarter
force-pushed
the
record-before
branch
4 times, most recently
from
May 21, 2026 15:29
9f05cb2 to
045b245
Compare
claytonrcarter
force-pushed
the
record-before
branch
from
June 13, 2026 00:43
045b245 to
aaa2be4
Compare
claytonrcarter
force-pushed
the
record-before
branch
2 times, most recently
from
July 10, 2026 02:30
413ca1d to
8abfb29
Compare
Prep only, no logic changes yet.
Prep only, no logic changes. This sould make the next diff more concise.
When --before is used: 1. The commit C is created normally as a child of HEAD (B). 2. A c_alt commit is created in-memory as a child of B's parent (A), with the same tree and metadata as C. 3. A RewriteEvent records C as obsolete (replaced by c_alt). 4. `git reset --soft HEAD~` moves HEAD back to B, orphaning C and making it invisible in the DAG (preventing constraint cycles). 5. A rebase plan moves B to be a child of c_alt, yielding B'. The result is A <- c_alt <- B', with HEAD and any branch tracking B'. Four test cases covering the new --before behaviour: - test_record_before: basic happy path - working-copy changes are inserted before HEAD as a new commit; HEAD (and its branch) advance to the rebased original HEAD. - test_record_before_with_new: --new --before inserts an empty commit before HEAD and rebases HEAD on top of it. - test_record_before_rewrite_public_commit: warns when HEAD is a public commit and prints a specific `git move` invocation to force-proceed. - test_record_before_merge_conflict: conflict during the rebase of HEAD is surfaced with the Before remediation message.
claytonrcarter
force-pushed
the
record-before
branch
from
July 15, 2026 10:42
8abfb29 to
93e1392
Compare
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.
wip, currently includes #1612