Gitprompt onlyIntermediate

Large Commit Splitter

Automatically splits large, monolithic Git commits into smaller, more reviewable units while preserving logical code boundaries and maintaining clean history.

← all loops
gitcommit splittingversion controlcode reviewrefactoring

Goal

Create smaller commits

How to Run

Guide the agent through splitting large commits into granular changes

  1. 01

    Setup Environment

    Ensure you're in a Git repository with staged or uncommitted changes

  2. 02

    Run Initial Audit

    Execute 'git diff --stat' to assess current change volume

  3. 03

    Iterate Splitting

    Prompt agent to split commits based on file boundaries or logical units

  4. 04

    Verify & Commit

    Review each proposed split and confirm with 'git commit'

Workflow Steps

  1. 01

    Analyze current staged changes using git diff --name-status and git diff --stat

    Identify files and overall scope of changes

  2. 02

    Group related file changes by logical component or feature area

    Create coherent commit boundaries

  3. 03

    Create interactive add hunks for first logical group using git add -p

    Stage portion of changes for initial small commit

  4. 04

    Commit staged changes with descriptive message

    Create first smaller commit

  5. 05

    Repeat process for remaining changes until all are committed

    Ensure all original changes are preserved in split form

  6. 06

    Run 'commit audit' to verify each commit meets size targets

    Check exit condition achievement

Kickoff Prompt

Start the "Large Commit Splitter" loop.

Goal: Create smaller commits
Max iterations: 10
Between iterations run: commit audit
Exit when: Commit size target reached


Please analyze my current staged changes and split them into multiple smaller commits, ensuring each commit is under 200 lines changed and represents a coherent logical change. Maintain clean commit messages that describe each change clearly. Start by checking what files are currently staged with 'git diff --name-status' and 'git diff --stat' to understand the scope.

Self-pace this loop. After each iteration, run `commit audit` and evaluate the output, and only continue if the exit condition is not met (Commit size target reached). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.

Guardrails

hardcoded
  • ·Only modify uncommitted changes, never alter committed history
  • ·Do not force push or rewrite public branches during splitting
  • ·Maintain meaningful commit messages for each split change
  • ·Preserve file modification integrity across splits
  • ·Avoid splitting mid-function or mid-logic block
  • ·Recommend maximum 100-200 lines per split commit

Flow Diagram

rendering…

Related loops — Git