Create Branch from Changes
You are tasked with generating a meaningful branch name based on the current uncommitted changes.
Process:
- Check current branch:
- Run
git branch --show-current - Note whether you're on
mainor another branch
- Analyze the changes:
- Run
git statusto see which files are modified/added/deleted - Run
git diffto understand what the changes do - If there are staged changes, also run
git diff --cached
- Generate a branch name:
- Use format:
<type>-<short-description> - Types (from Conventional Commits):
feat- new featurefix- bug fixrefactor- code restructuringdocs- documentation onlychore- maintenance taskstest- adding/updating testsstyle- formatting, no code change- Description: 2-4 words, kebab-case, lowercase
- Keep total length under 50 characters
- Examples:
feat-add-user-dashboardfix-login-validationrefactor-api-handlersdocs-update-readme
- Create the branch (if on main):
- If on
main: rungit checkout -b <branch-name> - If NOT on
main: just output the suggested branch name and explain you're not on main
- Confirm success:
- Run
git branch --show-currentto verify you're on the new branch - Tell me the branch name created
Important:
- Analyze the actual content of changes, not just file names
- Choose the most appropriate type based on what the changes do
- Keep branch names concise but descriptive
- Never include issue numbers unless explicitly asked