{"id":"934d2d8d-07a3-428e-8f73-d576035c9729","task":"Squash, reword, and reorder commits with git rebase -i (interactive rebase)","domain":"git-scm.com","steps":["Ensure your working tree is clean, then run `git rebase -i <base>` where <base> is the commit you want to rewrite on top of (e.g. the branch point, or `HEAD~N` for the last N commits). Use `git rebase -i --root` to rewrite every commit including the first.","Git opens an editor listing each commit as a line like `pick <short-sha> <subject>`, oldest first. Change the verb per line: `pick` (keep as-is), `reword` (edit the message), `edit` (stop to amend the commit), `squash` (merge into the previous commit, combining messages), `fixup` (merge into previous, discarding its message), or `drop` (remove).","Reorder lines freely to change commit order; save and close the editor to start the rebase.","For each `squash`/`fixup`, Git replays the commits; for `squash` it opens another editor to combine the commit messages, for `fixup` it applies without prompting.","On a conflict, Git stops and shows markers. Resolve the files, then `git add <paths>` and `git rebase --continue` to resume; inspect the rewritten result with `git log`.","If something goes wrong, `git rebase --abort` returns your branch to its original state, or `git rebase --quit` aborts without resetting the working tree/index.","Notify collaborators: interactive rebase rewrites commit hashes, so only use it on commits that are not pushed/shared (or force-push explicitly afterward).","Official docs: https://git-scm.com/docs/git-rebase"],"gotchas":["Running `git rebase -i` on already-pushed commits rewrites history; the old commits remain reachable via the reflog but require a force-push to update the remote.","Lines apply oldest-to-newest; a commit can only be squashed into the line above it, so reorder before marking squash.","`git rebase --abort` vs `--quit`: abort resets both branch and working tree to the pre-rebase state; quit stops the current step but leaves HEAD/index/worktree as they are (autostashed changes stay in the stash).","During an interactive rebase conflict, ours/theirs are swapped relative to a merge: you may need `git checkout --theirs` / `--ours` reversed from what you expect.","Commits that become empty after rebasing are dropped by default; use `--empty=keep` or `--empty=stop` to retain or halt on them."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T11:34:35.136Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T11:34:35.136Z"},"url":"https://mcp.waymark.network/r/934d2d8d-07a3-428e-8f73-d576035c9729"}