7

How do I archive export a git repository at a specified commit with commit history?

Using git archive --output=test.zip 898a4ca exports the files but there is no .git, and hence no commit history or branches.

Basically I want to be able to export a git repo at a certain point in time - including the commit history and branches to that point.

This is useful for giving clients a copy of the repo up until the milestones they have paid for.

Is this possible?

0

1 Answer 1

6

You can use git bundle to do that:

git bundle create <filename> <commit you want>

See the documentation for more details: http://www.git-scm.com/docs/git-bundle

Sign up to request clarification or add additional context in comments.

3 Comments

Is there any way to export a bundle as a .zip object?
@Ike348 use - as the filename and pipe it to zip, using - as the input as well: git bundle create - <commit you want> | zip bundle.zip -
Ah, I didn't specify my question well. This will still produce a pack object and then zip it. I am looking for something that unzips to a proper file directory (like zips produced with git archive) but still includes the entire git history.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.