Amend Commit

VerifiedSafe

Modifies the most recent commit by adding staged changes, updating the message, or both. Helps when you need to add forgotten files, fix a typo in the commit message, or reformat it to follow Conventional Commits.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude CodeCursorWindsurfCopilotCodex
#git#amend#version-control#conventional-commits

Recommended for

Automated summary

Modifies the most recent commit by adding staged changes or updating the commit message, following the Conventional Commits specification.

Strengths

  • Safely handles forgotten files or message typos in the last commit.
  • Validates conventional commit format automatically.
  • Warns about pushed commits or merge commits to prevent issues.

Limitations

  • Cannot amend merge commits.
  • Requires explicit confirmation for force-push if commit is already on remote.
  • Only modifies the most recent commit.
When to use it

Use this skill when you need to quickly fix the last commit without creating a new one.

When not to use it

Avoid using it if the commit has been pushed and you don't want to force push, or if it's a merge commit.

Security analysis

Safe
Quality score90/100

The skill only uses standard git commands for amending commits, with safety checks to prevent amending pushed/merge commits. No destructive, exfiltrating, or obfuscated actions.

No concerns found

How this analysis is made

Examples

Add forgotten files to last commit
I forgot to include the README changes in my last commit. Can you amend it to add those staged changes?
Fix commit message type
git:amend fix
Replace commit message entirely
Can you amend the last commit to have a new message: 'feat(api): add login endpoint'

name: git:amend description: Amend Commit - modifies the last commit with staged changes or new message

Amend Commit

Modifies the most recent commit by adding staged changes, updating the message, or both. Follows Conventional Commits specification for message formatting.

When to use

Use this skill when the user needs to:

  • Add forgotten files to the last commit
  • Fix a typo in the last commit message
  • Combine small fixes into the previous commit
  • Update commit message to follow conventions

Instructions

Step 1: Check Current State

  1. Run git log -1 --pretty=format:"%h %s" to show the last commit
  2. Run git diff --cached --stat to see if there are staged changes
  3. Run git diff --stat to see unstaged changes

Display to user:

Last commit: a1b2c3d feat(auth): add login form

Staged changes: 2 files
Unstaged changes: 1 file

Step 2: Determine Amend Type

Based on state and user intent:

| Scenario | Action | |----------|--------| | Staged changes, no message provided | Add changes, keep message | | No staged changes, message provided | Update message only | | Staged changes + message provided | Add changes + update message | | No staged changes, no message | Ask what user wants to do |

Step 3: Handle Staged Changes

If there are staged changes to add:

  1. Show the diff summary
  2. Confirm these should be added to the last commit
  3. Warn if changes seem unrelated to the original commit

Step 4: Handle Message Update

If updating the message:

  1. Parse current message - Extract type, scope, description
  2. Apply changes:
    • If user provides full message → use it
    • If user provides partial (e.g., just type) → merge with existing
  3. Validate format - Ensure Conventional Commits compliance

Quick fixes:

  • git:amend fix → Change type to fix, keep rest
  • git:amend (api) → Change scope to api, keep rest
  • git:amend "better description" → Update description only

Step 5: Confirm and Execute

Show the planned changes:

Amending commit a1b2c3d

Current:  feat(auth): add login form
New:      fix(auth): add login form validation

Adding: 2 files (+15, -3 lines)

Proceed? [Y/n]

If approved, run:

# Message change only
git commit --amend -m "<new message>"

# Changes only (keep message)
git commit --amend --no-edit

# Both
git commit --amend -m "<new message>"

Important: Do NOT add Co-Authored-By, Signed-off-by, or any other trailers to the commit message.

Step 6: Safety Checks

Before amending, verify:

  1. Not pushed - Warn if commit exists on remote:

    ⚠️ Warning: This commit appears to be pushed to origin.
    Amending will require force push. Continue? [y/N]
    
  2. Not a merge commit - Refuse to amend merge commits:

    ❌ Cannot amend merge commits. Use git revert instead.
    
  3. Clean working tree - If there are unstaged changes, ask:

    You have unstaged changes. Options:
    1. Stage all and include in amend
    2. Amend with only currently staged changes
    3. Cancel
    

Error Handling

  • If amend fails, show the error and suggest fixes
  • If there's nothing to amend (no changes, same message), inform user
  • If in rebase/merge state, refuse and explain

Arguments

  • <args> - Optional. Can include:
    • New type: feat, fix, docs, etc.
    • New scope: (auth), (api)
    • New message: "full commit message"
    • --no-edit - Keep current message, just add staged changes

Examples:

  • git:amend - Interactive: ask what to change
  • git:amend --no-edit - Add staged changes, keep message
  • git:amend fix - Change commit type to fix
  • git:amend (api) - Change scope to api
  • git:amend "feat(auth): add login validation" - Replace entire message

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/amend-commit-mmh8qr7z/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/amend-commit-mmh8qr7z' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/amend-commit-mmh8qr7z/download' --output '.skill-downloads/amend-commit-mmh8qr7z/SKILL.md.part' && mv '.skill-downloads/amend-commit-mmh8qr7z/SKILL.md.part' '.skill-downloads/amend-commit-mmh8qr7z/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/amend-commit-mmh8qr7z/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills