save old git repository versions

前端 未结 2 1571
清酒与你
清酒与你 2021-01-23 18:29

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

相关标签:
2条回答
  • 2021-01-23 19:15

    I think tag will help. Every time you like to save all the current files, type something like git tag -a v1.4 -m 'version 1.4'. So once you want those files back, commit or stash changes first, then type git checkout v1.4, the files will rollback to the time you tagged. Check these link for further infomation: how to tag and how to get them back.

    0 讨论(0)
  • 2021-01-23 19:17

    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?

    0 讨论(0)
提交回复
热议问题