[英]Git Clone, Delete the GitHub Repo, create new repo-->still have commit history?
I'm a newbie to git, and was hoping to delete a particular GitHub repository (from public view purposes). 我是git的新手,并且希望删除特定的GitHub存储库(出于公共目的)。 However, I'd like to keep a "copy" on my local computer with all its previous commits.
但是,我想在本地计算机上保存所有先前提交的“副本”。 If I git clone the repo, delete the repo on GitHub, then create a new repo, and finally push the local cloned project to the new repo, will the new repo have my commit history?
如果我git复制存储库,请在GitHub上删除存储库,然后创建一个新存储库,最后将本地克隆的项目推送到新存储库,新存储库是否有我的提交历史记录? Is this because the commit history is "stored" in my local project?
这是因为提交历史记录已“存储”在我的本地项目中吗?
Thanks! 谢谢!
Yes, it will still have the history, as the entire repo (which includes the history) is pushed. 是的,当推送整个仓库(包括历史记录)时,它仍将具有历史记录。
If you want to create a version of the repo without the history, do the following: 如果要创建没有历史记录的版本库,请执行以下操作:
git init .
git init .
git add .
git add .
Now newdir will contain a repo with just a single commit, which contains the latest from your repository, and you can push that . 现在,newdir将仅包含一个提交就包含一个存储库,其中包含来自存储库的最新提交,您可以将其推送。
Yes, the new repo will still have your commit history. 是的,新的仓库仍将保留您的提交历史记录。 When you "clone" a repo, you are cloning ALL aspects of it, which include commit history.
当您“克隆”一个仓库时,您正在克隆它的所有方面,包括提交历史。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.