git-history
Skill0 starsChanged 3 days agoMITView on GitHub
Rewrite git history safely without an interactive editor: fixup commits, autosquash, interactive rebase (reword, edit, split, squash, drop), amend, and force-push. Use when changing commits that already exist.
- Deletes or force-pushes
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- h-wata/claude-skillstheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- h-wata/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-contextSkill
- agent-pluginsSkill
- architecture-decisionsSkill
- brand-identitySkill
- browser-controlSkill
- cross-harnessSkill
- efficient-tool-callsSkill
- github-actionsSkill
- gitignore-standardsSkill
- html-reportSkill
- java-developmentSkill
- mermaid-diagramsSkill
- meta-workspaceSkill
- product-designSkill
- project-backlogSkill
- project-setupSkill
- project-upgradeSkill
- python-developmentSkill
- refinement-tribunalSkill
- session-handoffSkill
- shell-scriptsSkill
- software-architectureSkill
- technical-documentationSkill
- test-designSkill
- typescript-developmentSkill
- web-auth-bridgeSkill
- worktree-isolationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 25
Before any rebase, show the proposed changes (which commits are reordered, squashed, dropped, or reworded) and get the user's confirmation.
- Very specific: line 26
Never open an editor. Interactive editors are unavailable to agents.
- Very specific: line 27
Use --autostash on rebases when the working tree is dirty.
- Very specific: line 29
If the commits were already pushed, follow *Force-push* below.
- Distinctive: line 30
If anything goes wrong mid-rebase, git rebase --abort restores the original state.
- Distinctive: line 34
Before rewriting, resolve the push destination and pin its tip once:
- Very specific: line 46
If remote or ref is empty, or the push remote differs from the upstream remote (%(upstream:remotename)), ask the user which remote and …
- Very specific: line 47
If the ancestry check fails, stop: the remote has commits HEAD lacks.
- Very specific: line 48
Write the printed remote, ref, and lease into your notes.
- Distinctive: line 50
After the rewrite, explain that a force-push is needed and collaborators must reset.
- Very specific: line 66
Before Git 2.44, --autosquash needs -i: run GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <oldest-target>~1.
- Very specific: line 71
Start: git rebase -i --autostash <target-hash>~1.
- Distinctive: line 82
After each stop, git rebase --continue.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git history
Change existing commits with predictable, non-interactive commands, and confirm before anything that affects a shared branch.
Pick the operation
| Need | Operation |
| Add a small forgotten change to an earlier commit | Fixup + autosquash |
| Change the last commit only | git commit --amend |
| Reword a message, split, reorder, squash, or drop commits | Interactive rebase |
| A separate logical change | A new commit, not a rewrite |
Rules
- Show
git log --oneline -n 10, name the target commit by hash and subject, and ask when it is ambiguous. - Before any rebase, show the proposed changes (which commits are reordered, squashed, dropped, or reworded) and get the user's confirmation.
- Never open an editor. Interactive editors are unavailable to agents. Set
GIT_SEQUENCE_EDITORand edit the todo file directly (rebase-editor.md). Never use--edit-todo. - Use
--autostashon rebases when the working tree is dirty. - New or reworded messages follow the repository's commit conventions.
- If the commits were already pushed, follow Force-push below. Never use
--forceor a bare--force-with-lease, which trusts a remote-tracking ref that a background fetch can move. - If anything goes wrong mid-rebase,
git rebase --abortrestores the original state.
Force-push
Before rewriting, resolve the push destination and pin its tip once:
b="refs/heads/$(git symbolic-ref --short HEAD)"
remote=$(git for-each-ref --format='%(push:remotename)' "$b")
ref=$(git for-each-ref --format='%(push:remoteref)' "$b")
[ -n "$ref" ] || ref=$(git for-each-ref --format='%(upstream:remoteref)' "$b") # push.default simple/upstream
git fetch "$remote" "$ref"
lease=$(git rev-parse FETCH_HEAD)
git merge-base --is-ancestor "$lease" HEAD && echo "remote=$remote ref=$ref lease=$lease"- If
remoteorrefis empty, or the push remote differs from the upstream remote (%(upstream:remotename)), ask the user which remote and branch the commits were pushed to. - If the ancestry check fails, stop: the remote has commits
HEADlacks. Integrate them, then run the block again. - Write the printed
remote,ref, andleaseinto your notes; later commands may run in a fresh shell. Use those exact values, never a re-readFETCH_HEAD.
After the rewrite, explain that a force-push is needed and collaborators must reset. With the user's explicit yes:
git push --force-with-lease="<ref>:<lease>" <remote> "HEAD:<ref>"Fixup and autosquash
git add <files> # or git add -p <file>
git commit --fixup=<target-hash> # creates "fixup! <target subject>"
git rebase --autosquash <oldest-target>~1 # Git 2.44+; runs without stopping
git log --oneline -n 5 # fixup commits are gone
git show <new-target-hash> # target holds both changesBefore Git 2.44, --autosquash needs -i: run GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <oldest-target>~1. Several fixups for different targets apply in one autosquash rebase from the oldest target. A fixup carries changes only. To change a message, use a rebase edit stop.
Interactive rebase
- Set the sequence editor so the rebase stops before the first commit (rebase-editor.md).
- Start:
git rebase -i --autostash <target-hash>~1. ExpectStopped at ...from the insertedbreak. - Edit
.git/rebase-merge/git-rebase-todo(in a worktree,$(git rev-parse --git-path rebase-merge/git-rebase-todo)): changepicktoedit,fixup, ordrop, or reorder lines. To reword, useedit:rewordopensGIT_EDITOR, which an agent cannot drive. git rebase --continue, then handle each stop:
| Action | At the stop |
edit, reword | git commit --amend -m "<message>" |
edit, add files | git add <files>, git commit --amend --no-edit, check with git show --stat |
edit, fix content | Change files, git add, git commit --amend --no-edit, check with git show |
edit, split | git reset HEAD~1, then commit each part with git add -p |
After each stop, git rebase --continue.
Then show the new git log --oneline and mark which commits changed. Confirm with the user before pushing.
References
- rebase-editor.md: read before any interactive rebase. It has the sequence-editor setup for Bash and PowerShell.
- troubleshooting.md: read on conflicts, a fixup aimed at the wrong commit, or a stuck rebase.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

