Rename branch skill
Rename the currently checked out Git branch to a requested new branch name both locally and on its remote. Use when the user asks to rename the current branch, selected branch, checked-out branch, or active branch locally and remotely, including updating upstream tracking and deleting the old remote branch after the new remote branch is pushed.From its SKILL.md
npx -y skills add TopScrech/rename-branch-skillAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.5 KB, 481 tokens by cl100k_base, as published. Nobody here has run it
Rename Branch
Workflow
Use scripts/rename_current_branch.sh for the actual rename whenever possible. It handles the fragile ordering and guardrails:
- Verify the workspace is a Git repository and HEAD is attached to a branch
- Validate the requested new branch name with Git
- Infer the remote from the current branch upstream, then
origin, then a single configured remote - Refuse the rename if the target local branch or target remote branch already exists
- Refuse remote default branch renames unless the user explicitly confirms that risk
- Push the current HEAD to the new remote branch and set upstream tracking
- Rename the local branch
- Delete the old remote branch only after the new remote branch push succeeds
Commands
From the target repository root or any path inside it:
/path/to/rename-branch/scripts/rename_current_branch.sh new-branch-name
Pass a remote when the repository has multiple remotes or the requested remote is not the upstream remote:
/path/to/rename-branch/scripts/rename_current_branch.sh --remote origin new-branch-name
Preview the commands without changing branches:
/path/to/rename-branch/scripts/rename_current_branch.sh --dry-run new-branch-name
If the current branch is the remote default branch, ask the user for explicit confirmation before using:
/path/to/rename-branch/scripts/rename_current_branch.sh --allow-default-branch new-branch-name
Agent Guidance
Before running the script, state the current branch, target branch name, and remote that will be used. If the user did not provide a new name, ask for it.
Prefer a dry run first when the repository has multiple remotes, unclear upstream tracking, or when the current branch name is main, master, trunk, develop, or a release branch.
Do not manually delete the old remote branch before confirming the new remote branch was pushed successfully. Git has no atomic remote rename operation, so the safe sequence is push new first, then delete old.
After the script completes, verify with:
git branch --show-current
git status --short --branch
git ls-remote --heads <remote> <old-branch> <new-branch>
What ships with it: 4 files
4.9 KB alongside SKILL.md, 1 of them executable
agents/
- openai.yaml210 B
scripts/
- rename_current_branch.shruns4.5 KB
- .gitattributes66 B
- README.md195 B