AgentSkillsCN

rename-commits

逐步重命名当前分支的本地提交,逐次展示每次提交的变更内容,并在交互式变基过程中进行修正。

SKILL.md
--- frontmatter
name: rename-commits
description: Renames the local commits of the current branch step by step, shows the changes on each commit and makes an amend inside the interactive rebase.
allowed-tools: Bash, Bash(git *), Read, Grep

Your task

-look at the changes in each commit and rename it according to the changes -work strictly in the current branch -start working from the first commit that contains the word "Test" in the current branch to the last commit that contains the word "Test" (the most recent one)

What to do

-Use git rebase -i in headless mode via GIT_SEQUENCE_EDITOR -Edit the rebase-todo file by line number instead of SHA -Apply consistent replacements: --one commit: 1s/^pick/reword/ --all commits: s/^pick /reword / -Consider the order of lines to be stable (from old to new) -Understand that if GIT_SEQUENCE_EDITOR is set, the interactive editor will not open -After reword, expect Git to stop to enter a new message

What not to do

-Stick to specific SHA in rebase-todo -Expect vim/nano to open when GIT_SEQUENCE_EDITOR is set -Mix interactive mode and automatic editing -Use sed without considering the actual contents of rebase-todo -Assume that the set of commits will match between different HEAD~N

Short rule

If GIT_SEQUENCE_EDITOR is set, the agent is fully responsible for the correct editing of rebase-todo. The only stable reference is the line number, not the SHA of the commit.

If something goes wrong

-If you can't change the commit name for some reason, describe your issues and stop -Abort the process completely: git rebase --abort

Additional information

-Commit language is English -Do one commit at a time -Made one commit, completed the work, no more is required of you