Claude Skills Guide

Claude Code Git Rebase Interactive Workflow

Git rebase interactive is one of the most powerful tools in a developer’s arsenal for maintaining clean commit history. When combined with Claude Code skills, it becomes even more productive. This guide covers practical workflows, skill combinations, and automation patterns that will transform how you manage your git history.

Understanding Git Rebase Interactive

The git rebase -i command lets you modify commits in your history before pushing to a shared branch. You can reorder commits, squash multiple commits into one, edit commit messages, or drop unnecessary commits entirely. This creates a linear, readable history that makes code reviews and bug tracking significantly easier.

Start an interactive rebase with:

git rebase -i HEAD~n

Replace n with the number of commits you want to review. This opens your default editor with a list of commits and available commands.

Common Rebase Operations

The interactive rebase offers several actions:

For example, to squash the last three commits into one:

git rebase -i HEAD~3

In the editor, mark the second and third commits with squash or s:

pick abc1234 Add user authentication
squash def5678 Fix typo in auth module  
squash ghi9012 Update auth tests

Save and close the editor. Git opens another prompt for your new commit message.

Claude Code Integration

While Claude Code doesn’t have a dedicated /git-rebase skill, you can use other skills to enhance your rebase workflow. The /supermemory skill stores your preferred commit message patterns, and the /tdd skill ensures your commits include appropriate test coverage.

Using /supermemory for Commit Patterns

Activate supermemory to store your team’s commit conventions:

/supermemory
Remember these commit message patterns: feature/FEATURE-NAME, fix/BUG-NAME, refactor/DESCRIPTION, docs/UPDATE

When you rebase and need to write good commit messages, Claude remembers your patterns and suggests compliant messages.

Using /tdd Before Rebasing

Before squashing commits, verify that your changes still pass tests:

/tdd
Run the test suite for the changes in the last 3 commits to ensure nothing broke

This prevents accidentally combining commits that introduce bugs into a single “working” commit.

Practical Workflow Examples

Cleaning Up Feature Branches

When your feature branch is ready for merge, clean the history:

git rebase -i main

Your editor shows commits like:

pick a1b2c3d Initial feature implementation
pick e5f6g7h Add user input validation
pick i9j0k1l Fix linting errors
pick m2n3o4p Update documentation
pick q5r6s7t Fix typo in variable name

For a clean history, squash the fixes and updates into meaningful commits:

pick a1b2c3d Initial feature implementation
pick e5f6g7h Add user input validation
pick i9j0k1l Fix linting errors
pick m2n3o4p Update documentation
squash q5r6s7t Fix typo in variable name

The result: a logical progression from implementation through fixes to documentation.

Splitting Large Commits

Sometimes a commit does too much. Split it during rebase:

edit a1b2c3d Initial feature implementation

Git stops at that commit. Then:

git reset HEAD~
git add src/auth.js
git commit -m "Implement authentication module"
git add src/auth.test.js  
git commit -m "Add authentication tests"
git rebase --continue

Combining with the frontend-design Skill

When working on UI components, use /frontend-design to scaffold code, then rebase to organize:

/frontend-design
Create a login form component with email and password fields

After generating the component and tests, use interactive rebase to clean up the multiple commits into a single “Add login form component” commit.

Automating Rebase Workflows

For repetitive tasks, create shell aliases in your ~/.zshrc or ~/.bashrc:

# Quick squash of last n commits
function gsquash() {
    git rebase -i HEAD~$1
}

# Interactive rebase from main
function grebase() {
    git rebase -i $(git merge-base HEAD origin/main)
}

Use these in your terminal while Claude Code handles the reasoning:

/tdd
Review the changes in my current branch and suggest how to organize them into logical commits

Claude analyzes your changes and recommends a rebase strategy. You then execute with your alias.

Handling Rebase Conflicts

Rebase conflicts are inevitable. Here’s a practical approach:

  1. Identify conflicts: Git lists conflicting files
  2. Resolve manually: Edit each file, keep desired changes
  3. Stage resolved files: git add <resolved-file>
  4. Continue: git rebase --continue

Use the /tdd skill to verify your resolution doesn’t break existing functionality:

/tdd
Check if the conflict resolution in src/auth.js maintains the expected behavior for the authentication module

Best Practices

Generating Changelogs with /pdf

After cleaning your history, generate a changelog using the /pdf skill:

/pdf
Generate a changelog PDF from the commits in the release branch since v1.0.0

This extracts your clean commit messages into a formatted document for stakeholders.

Conclusion

The git rebase interactive workflow becomes significantly more productive when combined with Claude Code skills. Use /supermemory to remember your commit patterns, /tdd to verify changes before squashing, and /frontend-design to generate clean component commits. Your aliases handle execution while Claude provides intelligent guidance.

A clean git history isn’t just aesthetic—it’s a communication tool that helps teams understand context, trace bugs, and ship better software.


Built by theluckystrike — More at zovo.one