Git split

From phatblat/dotfiles · View interactive version

Git split is an AI agent skill from the GitHub repository phatblat/dotfiles. Split the most recent git commit into multiple logical commits without interactive rebase. Use when invoked as `$git-split` or when the user asks to split HEAD into smaller commits.

How to use this skill

Skill file

git-split

Split HEAD into two or more logical commits by soft-resetting it into the working tree and recommitting groups.

Workflow

  1. Validate state:

```bash

git rev-parse --abbrev-ref HEAD

git status --porcelain=v1

```

Stop if the working tree is dirty.

  1. Identify target:
  1. Inspect target:

```bash

git show --stat HEAD

git show --name-only HEAD

```

  1. Propose logical groups before changing history. Ask for confirmation if grouping is ambiguous or if the commit appears already pushed.
  1. Soft reset:

```bash

git reset HEAD~1

git status --porcelain=v1

```

  1. For each confirmed group:

```bash

git add <files>

git commit -m "<type>(<scope>): <description>"

```

Follow repo commit conventions and keep each commit to one coherent concern.

  1. Verify:

```bash

git log --oneline -6

git status --porcelain=v1

```

  1. Report the resulting commits. If the original commit was pushed, explain that a force-with-lease push is required.

Constraints: never use git rebase -i; never use git reset --hard.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.