Safely amend commits with HEAD verification and push checks
Amends the most recent commit after verifying it was created in this session and not yet pushed to remote.
/plugin marketplace add cowwoc/claude-code-dog/plugin install dog@claude-code-dogThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Purpose: Safely amend the most recent commit with proper verification checks.
# Check if pushed:
git status
# Look for: "Your branch is ahead of 'origin/main' by X commits"
# If it says "up to date" - DO NOT AMEND (already pushed)
# 1. Verify HEAD is the commit you want to amend
git log --oneline -1
# 2. Verify not pushed to remote
git status # Must show "ahead of origin"
# 3. Make your changes (edit files, stage new files)
git add <files>
# 4. Amend the commit
git commit --amend
# Or with new message:
git commit --amend -m "New message"
# Or keep same message:
git commit --amend --no-edit
# Edit the file
vim file.txt
# Stage and amend
git add file.txt
git commit --amend --no-edit
git add forgotten-file.txt
git commit --amend --no-edit
git commit --amend -m "Better commit message"
# NEVER amend if already pushed
git push origin main
git commit --amend # Creates divergent history!
# NEVER amend someone else's commit
git pull # Pulls teammate's commit
git commit --amend # Rewrites their work!
# If you must amend after push (with explicit permission):
git commit --amend
git push --force-with-lease # Safer than --force
To modify a commit that's NOT at HEAD, use interactive rebase:
# 1. Start interactive rebase
git rebase -i <commit>^ # Parent of commit to edit
# 2. Change 'pick' to 'edit' for the target commit
# 3. Make changes when rebase stops
git add <files>
git commit --amend
# 4. Continue rebase
git rebase --continue
# If amend was wrong, check reflog for original:
git reflog
git reset --hard HEAD@{1} # Go back to before amend
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.