保存旧的git存储库版本 [英] save old git repository versions
问题描述
对于我正在处理的项目,我需要保存特定版本的git存储库的所有文件。我已经浏览了大量关于git checkout的信息,但是我无法弄清楚对目录中的文件做了什么,更不用说保存该特定提交的版本了。有谁知道一种方式来获取特定提交的git存储库的文件吗?谢谢。
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.
推荐答案
git checkout [commit sha]
git archive --format zip --output /full/path/to/zipfile.zip master
然而,我不会不知道,为什么。通常一个人使用vcs是因为它保存了每个状态,所以当你需要时,为什么不标记它并检查出它?
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?
这篇关于保存旧的git存储库版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!