Git History Polish

Advanced techniques for cleaning up and organizing your local history before pushing to a shared repository.

jcorpac 2969a20 1.0 KB Updated

File contents

Git History Polish

Your local history is your "draft." Before you push to a shared repository, you should polish it into a clean, narrative-driven sequence of commits.

Tools

  • Interactive Rebase: git rebase -i <base> allows you to rewrite your local history.
  • Squash: Combine multiple small "wip" commits into a single atomic change.
  • Fixup: Like squash, but discards the log message of the combined commit. Perfect for fixing typos or small errors found after a commit.
  • Rewording: Edit the message of an old commit.

The Rule of Public History

NEVER rewrite history that has already been pushed to a shared branch. Rebase/Squash only what is local or on a private feature branch.

Value

A clean history makes it easy for future maintainers (including yourself) to understand why changes were made without wading through "WIP" noise.

jcorpac/ai-skills-library/tree/main/git/git-history-polish commit 2969a20eb6

Frequently asked questions

npx skillmds@latest add jcorpac/git-history-polish