Search code examples
gitfilerepositorycommitversions

save old git repository versions


For the project I'm working on, I need to save all the files of a specific version of a git repository. I've looked through a fair amount of information regarding git checkout but I can't figure out what that does to the files in the directory I have, let alone save the version of that specific commit. Does anyone know a way to get the files of a git repository at a specific commit? Thanks.


Solution

  • Do a "git export" (like "svn export")?

    git checkout [commit sha]
    git archive --format zip --output /full/path/to/zipfile.zip master
    

    However, I don't know, why. Usually one use a vcs exactly because it saves every state, so why don't you just tag it and check it out, when you need it?