refactor-git-plan

CANTAGESTUDIO's avatarfrom CANTAGESTUDIO

[Code Quality] Plans Git commit strategy for refactoring: branch naming, commit granularity, commit messages, and safe merge approach. Use to structure version control for reversible, reviewable changes.

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 25, 2025

When & Why to Use This Skill

The Refactor Git Plan skill is a specialized utility designed to optimize version control workflows during complex code refactoring. It provides a structured framework for branch naming, commit granularity, and standardized messaging, ensuring that all changes are atomic, reversible, and highly reviewable. By implementing these best practices, developers can maintain a clean Git history and significantly reduce the risk of introducing regressions during architectural shifts.

Use Cases

  • Scenario 1: Planning a large-scale architectural refactor where maintaining a clean, bisectable Git history is critical for long-term project health.
  • Scenario 2: Standardizing version control practices across a distributed engineering team to improve Pull Request clarity and accelerate the code review process.
  • Scenario 3: Executing high-risk code migrations that require a 'safety-first' approach, including frequent testing checkpoints and clear rollback strategies.
namerefactor-git-plan
description"[Code Quality] Plans Git commit strategy for refactoring: branch naming, commit granularity, commit messages, and safe merge approach. Use to structure version control for reversible, reviewable changes."

Refactor: Git Plan

Structure version control for safe, reviewable refactoring.

Branch Strategy

Naming Convention

refactor/<scope>-<action>
Examples: refactor/auth-extract-service

Commit Granularity

One Commit Per

  • Single rename across files
  • One method extraction
  • One file move
  • One pattern application

Commit Message Format

refactor(<scope>): <action>

<what changed and why>

Risk: low|medium|high
Tests: passing|added|updated

Safety Practices

Before Starting

  • Ensure clean state (git status)
  • Create branch
  • Verify tests pass

During Refactoring

  • Commit frequently
  • Run tests after each commit

If Something Breaks

  • git reset --soft HEAD~1 (undo, keep changes)
  • git checkout -- . (discard changes)
  • git revert (revert specific)