我有个代码库删除了一个分支,因为那个分支很占空间,所以删除了。
但是我从这个代码仓库的git服务器上(我自己搭建的git服务器)看这个代码库的存储文件夹空间大小并未改变。
分支删除后(git push origin :test
),如何删除远端仓库的分支并且使远程的仓库大小变小呢?
PHPz2017-04-24 09:14:36
Execute the git gc
及 git prune --expire
command in that repository to remove git objects that are no longer referenced. See: Git - Maintenance and Data Recovery
怪我咯2017-04-24 09:14:36
Sorry, I misunderstood.
Regardless of whether it is modified or deleted, the record is still there in case you want to restore it, so the size will not shrink after you delete it.
You need to delete the record of this branch
1 构建一个根提交
2 将提交迁移到根提交
See the git rebase command for details.