There is the git archive command - is there a way to create a tarball from a repo without making a commit? Essentially I just want to create tarball of the existing files (more importantly honoring gitignore). I assume git archive is looking for a commit - but I just want a snapshot of the code even for uncommitted changes.
Another way to do this would just be to write a program that will tar all the files and ignore what's in gitignore, but that would require writing that program.
git archiverequires a treeish to use, which means you need a tree, commit, or tag. There's nothing preventing you from creating a temporary branch and a commit with the contents you want and archiving that.Alternatively, if you're certain you don't care about the ignored files, you can run
git clean -dffxand then usetar --exclude-vcsto package your archive. You could also skip thegit cleaninvocation and trytar --exclude-vcs --exclude-vcs-ignores.