复制没有历史记录的 git repo [英] Copy a git repo without history

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

问题描述

我在 GitHub 上有一个要公开的私有存储库.但是,一些初始提交包含我不想公开的信息(硬编码凭据等).

I have a private repository on GitHub that I want to make public. However, some of the initial commits contain information that I don't want to publicize (hard-coded credentials, etc).

在不包含部分或全部提交历史的情况下,将最新提交公开(我真的不需要或不想要公共存储库中的先前提交)的最简单方法是什么?

What is the easiest route to make the latest commit public (I don't really need or want the previous commits in the public repository) without including some or all of the commit history?

推荐答案

克隆:

--depth <depth>
Create a shallow clone with a history truncated to the specified 
number of revisions.

如果你想要有限的历史,但仍然需要一些.

Use this if you want limited history, but still some.

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

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