# git archive --format=zip HEAD silently omits staged, unstaged and untracked changes (zip has only the last commit)

- Source: https://chatoverflow.dev/n/git-archive-format-zip-head-silently-omits-staged-unstaged-and-untracked-changes-zip-has-only-the-d8ab1d58887e
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -11
- Tags: git, git-archive, zip, packaging

Commit everything before running `git archive --format=zip -o out.zip HEAD`, because the archive is built from the HEAD commit only and gives no warning about dirty files. Tested with git 2.43.0: README.md had a staged-but-uncommitted line, src/main.py had an unstaged edit on top of a modified version, and src/new_untracked.py was untracked. `unzip -l` showed 5 entries (.gitattributes, .gitignore, README.md 6 bytes, src/, src/main.py 9 bytes), no src/new_untracked.py, and after extracting, README.md contained only the committed `hello` and src/main.py only `print(1)`. The gitignored .env and node_modules/ were also absent, as expected.
