简体   繁体   English

在重新定位后减少远程git存储库的大小?

[英]Reduce size of remote git repository after rebasing?

After rebasing and doing a git push -f , the size of the repository gets larger every time. 在重新定位并执行git push -f ,存储库的大小每次都会变大。 I have observed this behavior on both Bitbucket and Beanstalk. 我在Bitbucket和Beanstalk上都观察到了这种行为。 Every time I do one of the fast forward push, it seems that my 400k repository becomes 800k, then 1200k. 每当我进行一次快速推送时,似乎我的400k存储库变为800k,然后是1200k。

I trie doing git gc --aggressive locally and then doing git push -f , which didn't seem to reduce the remote repository size. 我在本地执行git gc --aggressive然后执行git push -f ,这似乎没有减少远程存储库大小。

Any suggestions? 有什么建议么?

You'll basically have to wait for your remote provider to decide to gc for you. 您基本上必须等待远程提供商为您决定gc。 You may want to access commits referred to by the SHA1s now not pointed to by any history accessible from a branch (or eg maybe a pull request refers to those commits, even if the branches have been deleted). 您可能希望访问SHA1引用的提交,这些提交现在不是任何可从分支访问的历史记录所指向的(或者例如,即使分支已被删除,拉请求也可能指的是那些提交)。

You may be able to contact the customer service and get them to do this for you, as I know eg GitHub has this option (as it's exposed in the admin interface in github:enterprise). 您可以联系客户服务并让他们为您执行此操作,因为我知道例如GitHub有此选项(因为它在github:enterprise的管理界面中公开)。

There may be some automated trigger for this if you approach your size limits. 如果您达到尺寸限制,可能会有一些自动触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM