AlexIIP
AlexIIP

Reputation: 2481

Git Archive ZIP Specified Files/Folders

I am trying to use git archive to archive only the files I specify and I am getting fatal: Not a valid object name error. Could someone provide an example?

My current code:

git archive -o ./archive/archive.zip ./folder1 ./folder2

The result should be an archive.zip file with folder1 and folder2 as the sub directories.

Thanks for the help.

Upvotes: 0

Views: 801

Answers (1)

CB Bailey
CB Bailey

Reputation: 792497

You need to specify a commit or tree to archive, e.g.:

git archive -o ./archive/archive.zip master folder1 folder2

or:

git archive -o ./archive/archive.zip HEAD folder1 folder2

Upvotes: 1

Related Questions