运行时git gc,git完成最多99%,然后锁定.我让它整夜运行,它从未完成,似乎没有进展.通常我必须硬重置机器才能恢复,因为一切都锁定了.因为机器变得完全没有反应,我无法得到top或htop统计.
我决定暂时忽略这个问题.然而今天,当运行a时git pull,git决定自动打包存储库,这会触发同样的错误.
这是它被卡住的地方:
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 428464, done.
Delta compression using up to 4 threads.
Compressing objects: 99% (93702/93718)
Run Code Online (Sandbox Code Playgroud)
这是Fedora 17上的Qt 4.8 C++项目.我有8GB的RAM,持有该项目的分区是33G,使用了27G(88%已满).
什么可能导致这个问题?如果机器缺乏运行资源git gc,有没有办法告诉git不要自动打包?
尝试下面的命令和面临的错误.
C:\project\sys\src>git gc
计数对象:6342699,完成.
警告:次优包装 - 内存不足
致命:内存不足,malloc失败(试图分配239971384字节)
错误:无法运行重新包装
我试过了
git config --global pack.windowMemory 256m
git repack -a -f -d
更新最新的git扩展
git gc --aggressive --prune=now
我尝试了很多选择.但我仍面临这个问题.任何想法为什么我收到这个错误?
有什么区别git gc和git repack -ad; git prune?
如果是,将采取哪些额外步骤git gc(反之亦然)?
哪个更适合空间优化或安全?
我有一个小的回购,有几个提交:
* a0fc4f8 (HEAD -> testbranch) added file.txt
* e6e6a8b (master) hello world now
* f308f53 Made it echo
* f705657 Added hello
* 08a2de3 (tag: initial) initial
Run Code Online (Sandbox Code Playgroud)
也:
$ git status
On branch testbranch
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
我无法理解以下行为.在这种状态下我跑:
$ git reset initial
我现在看到:
* e6e6a8b (master) hello world now
* f308f53 Made it echo
* f705657 Added hello
* 08a2de3 (HEAD -> testbranch, tag: initial) initial
Run Code Online (Sandbox Code Playgroud)
我期待的是:提交a0fc4f8将被删除,因为它无法访问.
发生了什么:
1)做git show a0fc4f8仍然显示提交
2)做git status …
我知道git会在repo变大时变慢。
但为什么?
由于git将文件存储为单独的目录和.git下的文件,所以我无法找出操作变慢的原因。让我们看一下提交操作。最近,我克隆了Webkit存储库,并从master分支,然后将2k文件提交到该分支。但是我觉得它比我的小仓库要慢。
因为我还没有阅读git源代码,所以我猜想提交操作会损害将文件存储到磁盘,插入提交日志,更新索引以及将HEAD更新为文件的sha值。
写入速度很快。
插入速度很快。(我想,如果插入操作是将日志追加到文件中)
,更新索引很快。
HEAD更新快。
为何慢呢?谁能向我说明?
谢谢。
一些答案很有帮助,但不是很令人信服,提供一些代码片段来支持您将非常有用。
如何通过以下命令确定阻止提交被git修剪的内容?
git reflog expire --expire=now --all
git gc --prune=now
Run Code Online (Sandbox Code Playgroud)
细节
我想XYZ从我的克隆中完全删除提交(例如,提交哈希).如果以上不是正确的命令(或者如果以下任何命令/扣除不正确),请告诉我.
我知道XYZ在运行上面的剪枝后仍然在我的克隆中,因为以下内容返回日志列表:
git log XYZ
Run Code Online (Sandbox Code Playgroud)
我知道这XYZ不在任何分支中,因为以下输出没有:
git branch --contains XYZ
Run Code Online (Sandbox Code Playgroud)
我认为这XYZ不是任何存储因为以下输出没有:
git stash list
Run Code Online (Sandbox Code Playgroud)
XYZ然而,实际上是在藏匿,但git bug阻止了藏匿列表.
git ×6
git-gc ×6
git-branch ×2
git-commit ×2
git-pull ×1
git-rebase ×1
git-reflog ×1
git-reset ×1