Skip to main content
command

update-branch-name — Claude Code command: what it does, how to install

Renames the active Git branch based on its changes against main. It is useful when you started coding on a temporary branch like temp.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command git-workflow/update-branch-name
Open on GitHub

What update-branch-name does

The command inspects modified files against main using git diff main...HEAD. Claude Code analyzes the diff and determines what task was completed.

Next, it generates a descriptive branch name. The agent updates the local branch with git branch -m [new-branch-name] and confirms the result via git branch.

The instructions explicitly check against main. If your primary branch is master or develop, the diff command will fail.

What it helps with

  • rename a working branch based on modified files
  • inspect differences between the current branch and main
  • update the local branch name without typing git branch -m manually

Example prompts for the agent

  • /update-branch-name
  • Rename the current branch based on my changes against main
  • Check the diff with main and update the branch name

How to install update-branch-name

1claude-code-templates

npx claude-code-templates@latest --command git-workflow/update-branch-name

2Manually: put the files in place

.claude/commands/update-branch-name.md

Call it with /update-branch-name. For all projects use ~/.claude/commands/

Questions about update-branch-name

How to install update-branch-name in Claude Code?

Run npx claude-code-templates@latest --command git-workflow/update-branch-name in your project root. The command definition will be placed in .claude/commands/update-branch-name.md.

What does update-branch-name do?

It compares your current work against main using git diff, suggests a fitting branch name, and executes git branch -m to rename it.

What is required for update-branch-name to work?

Your repository must have a main branch, because the prompt hardcodes git diff main...HEAD.

Source text

update-branch-name.md · MIT
---
description: "Rename the current branch to a descriptive name based on its changes against main"
---

# Update Branch Name

Follow these steps to update the current branch name:

1. Check differences between current branch and main branch HEAD using `git diff main...HEAD`
2. Analyze the changed files to understand what work is being done
3. Determine an appropriate descriptive branch name based on the changes
4. Update the current branch name using `git branch -m [new-branch-name]`
5. Verify the branch name was updated with `git branch`

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

All slash commands for Git and GitHub →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor