Skip to content
Back to skills

Git Intent Squash Archive

ASecurity

Squash every commit on the current branch into one, keeping the original commit stream recoverable in an `archive/<branch>` git tag. Use this whenever a working branch is finished and its step-by-step history should stop being noise for whoever reads the trunk — "squash branch", "squash and archive", "сверни ветку", "finalize this branch", "collapse these commits", "archive the history before merging" — even when the user never names the skill. For gi working branches; when the branch also ne...

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added October 25, 2026
toolsbashgit

Security analysis

A100/100

Scanned October 25, 2026

npx -y skills add nushell-prophet/claude-nu --skill git-intent-squash-archive --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Intent Squash Archive?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Intent Squash Archive
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nushell-prophet-git-intent-squash-archive/badge)](https://www.skillsdirectory.com/skills/nushell-prophet-git-intent-squash-archive)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-intent-squash-archive
description: Squash every commit on the current branch into one, keeping the original commit stream recoverable in an `archive/<branch>` git tag. Use this whenever a working branch is finished and its step-by-step history should stop being noise for whoever reads the trunk — "squash branch", "squash and archive", "сверни ветку", "finalize this branch", "collapse these commits", "archive the history before merging" — even when the user never names the skill. For gi working branches; when the branch also needs merging and `todo/`/`gi-canvas/`/`gi/` kept off the trunk, use `/land-branch` instead.
allowed-tools: Bash(git *)
---

A working branch's commits are rollback points while the work runs, and noise the moment it is done: an agent that later reads `git log` on the trunk wades through abandoned attempts and reversed decisions instead of history.
So the branch lands as one commit.
But those abandoned attempts are the record of *why* the surviving shape won, so the original stream is kept in a tag rather than dropped — squash for the reader, archive for the record.

This rewrites the branch (`git reset --soft`, `git tag -f`).
That is why steps 1 and 6 stop instead of warning: on a trunk the reset would rewrite history other people have, and once it has run there is nothing left to confirm.

In the mono — a repo with `mono.yml` at its root (`test -f "$(git rev-parse --show-toplevel)/mono.yml"`) — **STOP**, and tell the user to land the branch with `/mono-land` instead.
Why: `mono-land` squashes and archives too, under a tag name the mono's shared tag namespace can hold, and lands the branch.

Verify the working tree is clean (`git status --porcelain` returns empty).
If not, stop and ask the user to commit or stash first.

Archive and squash all commits on the current branch:

1. Get branch name: `git branch --show-current`.
   If `master` or `main` — **STOP immediately**, inform the user this command cannot run on the main branch, do not proceed with any further steps
2. Find base: `git merge-base main <branch>` (fall back to `master` if `main` doesn't exist)
3. List all commits on the branch: `git log --oneline <base>..<branch>`
4. If no commits — report and exit
5. Check if tag `archive/<branch>` already exists (`git tag -l archive/<branch>`).
   If it does, show the user what it points to and warn that it will be overwritten
6. Show the user: commit list, total count, tag overwrite warning (if applicable).
   **STOP.**
   Wait for confirmation before proceeding
7. `git tag -f archive/<branch> HEAD`
8. `git reset --soft <base>`
9. Generate commit message:
   - **Subject**: one line — what the branch accomplished
   - **Body**: summarize the decisions made on this branch, preserving the user's reasoning from original commit bodies where present, then an `Archive:` trailer naming the archived tip: its `Change-Id`, read with `git log -1 --format='%(trailers:key=Change-Id,valueonly)' archive/<branch>`, or the tag name `archive/<branch>` when that prints nothing
   - Strip every `Change-Id:` trailer from the bodies you fold in: the `commit-msg` hook adds an id only to a message that has none, so a copied trailer would become this commit's id — the same id as an archived commit
   - No hash and no short `Change-Id` of a commit inside `<base>..<branch>` in the body, the `Archive:` trailer aside: those name commits the trunk will not have, and the trailer names the archived tip on purpose
   - No diff restating; no listing of things you checked and didn't find
10. `git commit`
11. Show `git log --oneline -5`, name the new commit by its short `Change-Id` where it carries one (by sha only where the repo stamps none), and remind about `git log archive/<branch>` for the full history

## Related

- `/gi:git-intent` — process commits as instructions and propagate choices before squashing
- `/land-branch` — the general-development counterpart: same squash-and-archive, but it also merges to the trunk and drops `todo/`/`gi-canvas/`/`gi/`.
  Use it when the branch is not gi working material.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.