Delete or remove all history, commits, and branches from a remote Git repo?

后端 未结 2 1899
耶瑟儿~
耶瑟儿~ 2020-12-08 01:14

I\'ve read and tried lots of Git command recommendations and discussion, going on over several days now. It appears that there really is no simple, comprehensive way to

2条回答
  •  -上瘾入骨i
    2020-12-08 01:52

    You can't do this. The best you can do is to remove all refs and hope that the server runs git gc and has settings for prune objects that doesn't have any refs. This depends on the server configuration.

    Usually it takes 14 days before objects are removed by git gc. However those object won't be cloned if you try to clone the repository.

    You've already got a good answer of how to do a "hack" to remove all refs. It works and your repo will appear to you as it is "fresh". However it isn't.

提交回复
热议问题