rename-branch

v2026.09.24

Rename a git branch. Analyzes changes against the main branch, decides on a conventional name, and executes the rename.

GitHub
安装命令
npx skhub add jimmypaolini/rename-branch
Markdown
SKILL.md

Rename Branch

This skill provides a standardized workflow for renaming a Git branch to comply with the repository's Conventional Commits naming conventions (<type>/<scope>-<description>).

When to Use This Skill

  • When the user asks to "rename this branch" or "give this branch a better name".
  • When a branch name is rejected by a pre-push hook or CI validation and needs to be fixed.
  • When the user wants the agent to automatically deduce a conventional branch name based on the current local changes.

Workflow

When invoked, perform the following steps sequentially:

1. Analyze Changes

Use the terminal to understand what the branch is doing:

  • Check the current branch: git branch --show-current
  • Compare with the default branch to see what changed: git diff --name-status main...HEAD
  • If there are uncommitted changes, check them too: git status -s

2. Determine the Conventional Name

Using the repository's naming convention (<type>/<scope>-<description>):

Type: Choose the appropriate type based on the nature of the changes.

<!-- types-start -->
TypeDescription
featA new feature or capability that adds value for users
fixA bug fix that addresses a specific issue or problem
docsDocumentation, AGENTS.md, SKILL.md, README, and planning files
testAdding or correcting unit, integration, or end-to-end tests
refactorCode restructuring that neither fixes a bug nor adds a feature
styleFormatting, whitespace, or code structure changes with no semantic effect
perfA code change that improves performance (caching, query optimization, etc.)
choreHousekeeping that doesn't modify src or test files (gitignore, editor config, etc.)
ciGitHub Actions workflows, composite actions, and CI/CD scripts
buildBuild system, Vite/Docker/Helm config, or external dependency integration
revertReverts a previous commit
<!-- types-end -->

Scope: Identify the scope based on the directory of the modified files.

<!-- scopes-start -->
ScopeDescription
ic-suiteIn-house code measurement and validation toolchains (Callidescope, Codependix, Codometer, Conformetry) and their shared conventions
affirmationsPython Jupyter notebook application for LangGraph affirmation generation
caelundasNode.js CLI for astronomical calendar generation (NASA JPL ephemeris)
configurationWorkspace root config files (tsconfig, eslint, vitest, nx.json, etc.)
conformetryCode generator templates and validation tests for generated instances
dependenciesDependency version changes (upgrades, additions, removals via pnpm)
deploymentsGitHub Actions workflows and CI/CD pipeline configuration
documentationMarkdown docs, skills, planning files, and AGENTS.md files
infrastructureHelm charts, Terraform configs, and Kubernetes resources
JimmyPaoliniStatic GitHub profile README project (markdown and assets)
lexicoTanStack Start SSR Latin dictionary web app with Supabase backend
lexico-componentsShared React/shadcn component library
lexico-entitiesShared TypeORM entities and GraphQL types
lexico-ingestionData ingestion scripts for Lexico
meanderawGreek meander (key/fret) SVG generator CLI and the composable motif/modifier library it reads
sempientorLexical gap discovery CLI that surveys English for morphological, phonotactic, and semantic gaps and coins words to fill them
callidescopeCall stack tracing and linting CLI, the configuration package it reads, and the packages that build and render its call graph
codependixDependency graph export CLI, the configuration package it reads, and the package that judges the graphs against declared rules
codometerCode statistics measurement CLI, the configuration package it reads, and the packages that diff and render its pull request change report
no-releaseEscape hatch: suppress semantic-release for any commit type
releaseVersion bumps and release commits generated by semantic-release
reportingPull request change report generation and the packages that diff and render it
scriptsShell and TypeScript scripts in scripts/ (sync, setup, utilities)
testingVitest configuration, shared test utilities, and coverage setup
synchronizationSynchronization application and commands for automating workflows
validationValidation CLI and the checks it runs, such as pull request metadata
<!-- scopes-end -->

Description: Formulate a concise, lowercase, kebab-case description (e.g., add-user-auth).

Note: If multiple scopes are touched, list them comma-separated in the title (e.g., feat(lexico,logger): ...) rather than reaching for a single umbrella scope.

3. Create a Backup (Safety First)

Be very cautious before taking any destructive actions (renaming or deleting remote branches). Always create a temporary backup branch to ensure no work is lost:

Preferred approach: invoke backup-code before renaming so backup creation and recovery commands are documented.

branch_name="$(git branch --show-current)"
iso_timestamp="$(date -u +%Y-%m-%dT%H-%M-%SZ)"
git branch "backup/${branch_name}/${iso_timestamp}"

4. Execute the Rename

Proceed automatically with the best determined name without asking the user for permission. Run the appropriate Git commands to rename the branch.

git branch -m <type>/<scope>-<description>

5. Update Remote (If Applicable)

If the old branch was already pushed to the remote (git status shows it tracking an origin branch), you must push the new branch and delete the old one:

git push origin -u <new-branch-name>
git push origin --delete <old-branch-name>

If remote cleanup or rename operations are incorrect, use restore-code with the backup branch to recover safely.

Example Scenarios

Scenario 1: Uncommitted feature in lexico

  • Changes: Modified applications/lexico/src/components/Button.tsx
  • Derived Name: feat/lexico-button-component
  • Action: git branch backup/old-name/2026-06-22T12-00-00Z, then git branch -m feat/lexico-button-component

Scenario 2: Pushed bugfix in caelundas

  • Changes: Modified applications/caelundas/src/utils/time.ts (already pushed as fix-time)
  • Derived Name: fix/caelundas-time-calculation
  • Action: git branch backup/fix-time/2026-06-22T12-00-00Z, then git branch -m fix/caelundas-time-calculation, push new, and delete old remote.
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

2026年9月24日

分类

未分类

许可证

MIT

源路径

.agents/skills/rename-branch

默认分支

main

最新提交

5ac136d

Tree SHA

9af071d