【问题标题】:Deleted files from git cache do not reflect on the remote repository从 git 缓存中删除的文件不会反映在远程存储库中
【发布时间】:2014-08-19 11:18:14
【问题描述】:

我们的 git 存储库大约 600MB,因为有些图像是意外提交的。现在我们要从存储库中删除这些图像。如下:

$ du -hs .git/objects
606M    .git/objects
$ git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch public/images/upload_xx/" -- --all
$ git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch public/images/upload_xx/" --tag-name-filter cat -- --all
$ rm -rf ../.git/modules/flipit_application/refs/original/
$ git reflog expire --expire=now --all
$ git gc --prune=now
$ git gc --aggressive --prune=now
$ du -hs .git/objects
65M .git/objects

在我的本地系统上,repo 从 600MB 变为 65MB。推动它:

$ git push --all --force
$ git push --tags --force

这些更改似乎被推送到了 bitbucket,但每当我拉取一个新的克隆时,它仍然是 600MB 以上。

我错过了什么?

【问题讨论】:

    标签: git garbage-collection push bitbucket git-filter-branch


    【解决方案1】:

    您在本地 repo 上运行了 git gc,但它尚未在 Bitbucket 上运行,因此那里的远程 repo 仍然有那些旧对象。 Bitbucket 运行 git gc "automatically on a regular basis based on a variety of triggers"。所以下次运行时,您应该会看到对远程 repo 的影响(因此也会看到 repo 的新克隆)。

    【讨论】:

      猜你喜欢
      • 2014-11-19
      • 2012-08-31
      • 2012-11-28
      • 1970-01-01
      • 2017-08-15
      • 2013-02-10
      • 1970-01-01
      • 2020-10-31
      相关资源
      最近更新 更多