gpt4 book ai didi

没有历史的 Git 仓库

转载 作者:太空狗 更新时间:2023-10-29 14:38:05 26 4
gpt4 key购买 nike

有没有可能没有历史的 Git 仓库?例如,我有一个我工作的本地 Git 存储库,我想将最新版本推送到生产服务器。生产服务器上不应存储任何历史记录。我该怎么做?

最佳答案

你可以看到命令 git archive 符合要求:

Creates an archive of the specified format containing the tree structure for the named tree, and writes it out to the standard output.
If <prefix> is specified it is prepended to the filenames in the archive.

git archive behaves differently when given a tree ID versus when given a commit ID or tag ID.

  • In the first case the current time is used as the modification time of each file in the archive.
  • In the latter case the commit time as recorded in the referenced commit object is used instead.

创建存档后,您可以复制它并在服务器端解压缩:服务器上不需要 git。
由于您只需复制 一个 文件(而不是在您的工作树上使用 rsync 复制大量文件),因此传输更容易。

关于没有历史的 Git 仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27580782/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com