git-amend

Amend Git commits with selective staging and safety checks using Bash commands.

4|Updated Sep 25, 2025
One-click install
npx skills add https://github.com/cowwoc/styler --skill git-amend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-amend
Source: https://github.com/cowwoc/styler/tree/main/.claude/skills/git-amend
Command: npx skills add https://github.com/cowwoc/styler --skill git-amend

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Amending Git commits, especially older ones or those already pushed, can be risky, leading to unintended changes or requiring force pushes. This Skill provides a safe, controlled workflow for amending commits with critical safety checks, preventing errors and preserving history integrity.

Core Features & Use Cases

  • Selective Staging: Ensures only the explicitly specified files are staged for amendment, preventing accidental inclusion of unrelated changes.
  • Authorship Verification: Prevents amending commits authored by others without explicit permission, preserving attribution.
  • Push Status Check: Warns if a commit has already been pushed, alerting the user to the need for a force push.
  • Non-HEAD Amend Workflow: Guides through the fixup + autosquash workflow for safely amending older commits.
  • Use Case: If you forgot to include a config.json file in your last commit, use this Skill to safely add just that file to the commit, ensuring your history remains clean and accurate without affecting other changes or risking a messy rebase.

Quick Start

To add a forgotten file 'config.json' to your last commit: git add config.json git commit --amend --no-edit

Frequently Asked Questions about git-amend

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely add a forgotten file to my last commit without affecting other changes?

Amend commits by selectively staging only the files you need, then running `git commit --amend`. This Skill enforces selective staging to prevent accidental inclusion of unrelated changes, keeping your history clean and accurate.

Can I amend a commit that's already been pushed to a remote repository?

Yes, but amending pushed commits requires a force push. This Skill checks push status and warns you when a commit has already been pushed, so you understand the implications before proceeding with the amendment.

How do I amend an older commit that's not the HEAD?

Amend older commits using the fixup and autosquash workflow. This Skill guides you through the process with `git fixup` and `GIT_SEQUENCE_EDITOR`, safely reordering and squashing commits without manual rebase conflicts.

What prevents me from accidentally amending commits authored by someone else?

Authorship verification prevents amending commits you didn't author without explicit permission, preserving attribution and preventing unauthorized history changes in collaborative repositories.

Why should I use selective staging instead of amending all staged changes?

Selective staging ensures only specified files are included in the amended commit, eliminating the risk of accidentally bundling unrelated work and maintaining a focused, clean commit history.