Git archive of repository with uncommitted changes

git

Solution

I know this is old, but I think I found a solution.

Run:

stashName=`git stash create`;
git archive <options> $stashName

Since git wants a solid commit to make an archive, we can make a 'one off' commit using `git stash`. The `create` command just creates the stash commit (doesn't reset your working directory or push it to the stash stack) and returns the hash for it.

If you are worried about the space from the dangling commit, you can clean it up with a `git gc --prune=now`. Otherwise, just wait 2 weeks and it'll disappear.

Problem

How can I create an archive of the current repository including local uncommitted changes using `git archive`?

Original source

Related problems