Git: how to repack all loose commits

混江龙づ霸主 提交于 2019-12-04 04:10:21
VonC

Considering that git bundle is used to work with packaging objects only (calling fetch-pack), did you try to bundle, and then clone your repo?

git bundle create aBundle --all # hopefully package everything, 
                                # the result being *one* file.
git clone aBundle newRepo       # recreate a full repo
# check if the cloned repo contains only packaged object

If this works, you might go on, using the new cloned repo as your main repo.

The warning from git-gui is just a hint that you might want to do some maintenance. For most people having a high number of objects is just slowing them down. In your case, you should disable the warning. The function in question is hint_gc and it is called from near the end of the git-gui script file. Just comment it out as below.

if {[is_enabled multicommit]} {
        #after 1000 hint_gc
}

The multicommit business is a flag that determines if we are running as committool or a general purpose app.

If you want to use git-gui normally elsewhere, then you could add a respository specific flag instead. Something like:

if {[is_enabled multicommit] && ![is_config_true gui.skip_gc_warning]} {
        after 1000 hint_gc
}

should let you use git config --bool gui.skip_gc_warning true to disable that on a per-repository basis.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!