没有历史的Git仓库 [英] Git repository without history

查看:45
本文介绍了没有历史的Git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能没有历史记录的Git存储库?例如,我有一个本地Git存储库,我想在其中工作,并且要将最新版本推送到生产服务器.没有历史记录应存储在生产服务器上.我该怎么办?

Is it possible to have a Git repository without history? For example, I have a local Git repository where I work and I want to push the latest version to the production server. No history should be stored on the production server. How can I do that?

推荐答案

您可以查看命令 git存档 符合要求:

You can see if the command git archive fits the bill:

创建指定格式的存档,其中包含命名树的树结构,并将其写到标准输出中.
如果指定了< prefix> ,则将其添加到存档中的文件名之前.

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归档文件的行为有所不同.

  • 在第一种情况下,当前时间用作存档中每个文件的修改时间.
  • 在后一种情况下,将使用引用的提交对象中记录的提交时间.

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

Once you have created an archive, you can copy it and unzip it on the server side: no git required on the server.
Since you have to copy only one file (instead of a large number of files with rsync over your working tree), the transfer is easier.

这篇关于没有历史的Git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆