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
- Run
git log -1 --pretty=format:"%h %s" to show the last commit
- Run
git diff --cached --stat to see if there are staged changes
- 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:
- Show the diff summary
- Confirm these should be added to the last commit
- Warn if changes seem unrelated to the original commit
Step 4: Handle Message Update
If updating the message:
- Parse current message - Extract type, scope, description
- Apply changes:
- If user provides full message → use it
- If user provides partial (e.g., just type) → merge with existing
- 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:
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]
Not a merge commit - Refuse to amend merge commits:
❌ Cannot amend merge commits. Use git revert instead.
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
$ARGUMENTS ($0) - 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
Source: ikatsuba/skills — distributed by TomeVault.
1---2name: gitamend3description: Amend Commit - modifies the last commit with staged changes or new message Use when this capability is needed.4---56# Amend Commit78Modifies the most recent commit by adding staged changes, updating the message, or both. Follows Conventional Commits specification for message formatting.910## When to use1112Use this skill when the user needs to:13- Add forgotten files to the last commit14- Fix a typo in the last commit message15- Combine small fixes into the previous commit16- Update commit message to follow conventions1718## Instructions1920### Step 1: Check Current State21221. Run `git log -1 --pretty=format:"%h %s"` to show the last commit232. Run `git diff --cached --stat` to see if there are staged changes243. Run `git diff --stat` to see unstaged changes2526Display to user:27```28Last commit: a1b2c3d feat(auth): add login form2930Staged changes: 2 files31Unstaged changes: 1 file32```3334### Step 2: Determine Amend Type3536Based on state and user intent:3738| Scenario | Action |39|----------|--------|40| Staged changes, no message provided | Add changes, keep message |41| No staged changes, message provided | Update message only |42| Staged changes + message provided | Add changes + update message |43| No staged changes, no message | Ask what user wants to do |4445### Step 3: Handle Staged Changes4647If there are staged changes to add:481. Show the diff summary492. Confirm these should be added to the last commit503. Warn if changes seem unrelated to the original commit5152### Step 4: Handle Message Update5354If updating the message:55561. **Parse current message** - Extract type, scope, description572. **Apply changes**:58 - If user provides full message → use it59 - If user provides partial (e.g., just type) → merge with existing603. **Validate format** - Ensure Conventional Commits compliance6162**Quick fixes:**63- `git:amend fix` → Change type to `fix`, keep rest64- `git:amend (api)` → Change scope to `api`, keep rest65- `git:amend "better description"` → Update description only6667### Step 5: Confirm and Execute6869Show the planned changes:70```71Amending commit a1b2c3d7273Current: feat(auth): add login form74New: fix(auth): add login form validation7576Adding: 2 files (+15, -3 lines)7778Proceed? [Y/n]79```8081If approved, run:82```bash83# Message change only84git commit --amend -m "<new message>"8586# Changes only (keep message)87git commit --amend --no-edit8889# Both90git commit --amend -m "<new message>"91```9293**Important:** Do NOT add `Co-Authored-By`, `Signed-off-by`, or any other trailers to the commit message.9495### Step 6: Safety Checks9697**Before amending, verify:**98991. **Not pushed** - Warn if commit exists on remote:100 ```101 ⚠️ Warning: This commit appears to be pushed to origin.102 Amending will require force push. Continue? [y/N]103 ```1041052. **Not a merge commit** - Refuse to amend merge commits:106 ```107 ❌ Cannot amend merge commits. Use git revert instead.108 ```1091103. **Clean working tree** - If there are unstaged changes, ask:111 ```112 You have unstaged changes. Options:113 1. Stage all and include in amend114 2. Amend with only currently staged changes115 3. Cancel116 ```117118## Error Handling119120- If amend fails, show the error and suggest fixes121- If there's nothing to amend (no changes, same message), inform user122- If in rebase/merge state, refuse and explain123124## Arguments125126- `$ARGUMENTS` (`$0`) - Optional. Can include:127 - New type: `feat`, `fix`, `docs`, etc.128 - New scope: `(auth)`, `(api)`129 - New message: `"full commit message"`130 - `--no-edit` - Keep current message, just add staged changes131132Examples:133- `git:amend` - Interactive: ask what to change134- `git:amend --no-edit` - Add staged changes, keep message135- `git:amend fix` - Change commit type to fix136- `git:amend (api)` - Change scope to api137- `git:amend "feat(auth): add login validation"` - Replace entire message138139---140> Source: [ikatsuba/skills](https://github.com/ikatsuba/skills) — distributed by [TomeVault](https://tomevault.io).141<!-- tomevault:4.0:skill_md:2026-06-04 -->