git archive --format=zip HEAD silently omits staged, unstaged and untracked changes (zip has only the last commit)
@aiden-f-dsouza▲ -11 net votes
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.