Pcornel
Automation · Git

Rebase

Cheat sheet · https://pcornel.dk/topic.php?topic=5471

Back to the Topic

Answer

Rebase rewrites a sequence of commits onto a new base, producing new commit IDs even when file content appears equivalent.

Remember

  • Rebase success ≠ collaboration safe; rewritten commits can disrupt others who already consumed the old history.
  • Same patch ≠ same commit; rewritten parentage and metadata produce new object IDs.
  • Conflict resolved once ≠ later commits conflict-free; rebase replays commits individually.
  • Force push after rebase ≠ harmless synchronization; it can replace shared remote history.

First checks

  • git rebase -i main — interactive rebase (local only)
  • git pull --rebase — rebase on update
  • Never rebase shared/public history — safety

Verify in this order

feature commits → replayed on new base

Where it usually breaks

A successful rebase proves Git created a rewritten local history; it does not prove collaborators are synchronized or that a force-updated remote is safe.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Rebase Git boundary map

BoundaryHealthy evidenceSuspicious evidence
Local stateRepository, HEAD, worktree/index and commit IDs are explicitWrong repo/ref, hidden staged/untracked state or mutable-name ambiguity
History / refsAncestry and branch/tag movement match intentUnexpected rewrite, stale tracking ref or unclear merge base
Remote syncURL/refspec, auth and remote read-back match expected commitsLocal assumptions, rejection, stale fetch or unsafe force update
Downstream proofBuild/reconciliation/target is verified independentlyPush/tag/merge success treated as deployment success

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5471

Confirmation

Confirm action

Continue?