从远程Git仓库中删除所有文件和历史记录,而不删除仓库本身 [英] Delete all files and history from remote Git repo without deleting repo itself

查看:88
本文介绍了从远程Git仓库中删除所有文件和历史记录,而不删除仓库本身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人能告诉我如何删除我的git存储库上的每个文件/文件夹,而无需真正删除存储库本身,我将不胜感激。我想删除所有与这些文件相关的历史记录。

I would appreciate it if someone could tell me how I could delete every single file/folder on my git repository without actually deleting the repository itself. I want to delete all history associated with those files as well.

推荐答案

/ p>

You can delete a branch from a repository remote like this

git push origin :branchname

如果你有任何标签可以像这样删除它们:

if you've got any tags you can delete them like this:

git push origin :refs/tags/tagname

假设您有一个远程设置为github的原始名称

This is assuming you have a remote set up to github called origin

不过,这会让本地标签/分支留在您的计算机上。

This will leave the local tags / branches on your computer, though.

这篇关于从远程Git仓库中删除所有文件和历史记录,而不删除仓库本身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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