$ git clone --mirror ssh://git@example.com/some-big-repo.git
$ java -jar bfg-1.12.8.jar --strip-blobs-bigger-than 100M some-big-repo.git
以上命令的输出:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Using repo : some-big-repo.git
Scanning packfile for large blobs: 1064306
Scanning packfile for large blobs completed in 6,655 ms.
Found 17 blob ids for large blobs - biggest=548483051 smallest=154402960
Total size (unpacked)=6732468925
Found 13643 objects to protect
Found 175 tag-pointing refs : refs/tags/alpha_7_0_0_27, refs/tags/alpha_7_0_0_28, refs/tags/alpha_7_0_0_29, ...
Found 1886 commit-pointing refs : HEAD, refs/heads/CLI-PS-Command-Shows-Tag-And-Branch, refs/heads/IBIS-15065-ibis70, ...
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit 5ebfab47 (protected by 'HEAD') - contains 1 dirty file :
- system-profiles-backup.zip (147.3 MB)
WARNING: The dirty content above may be removed from other commits, but as
the *protected* commits still use it, it will STILL exist in your repository.
Details of protected dirty content have been recorded here :
some-big-repo.git.bfg-report/2015-12-16/16-30-47/protected-dirt/
If you *really* want this content gone, make a manual commit that removes it,
and then run the BFG on a fresh copy of your repo.
Cleaning
--------
Found 87529 commits
Cleaning commits: 100% (87529/87529)
Cleaning commits completed in 8,549 ms.
Updating 300 Refs
-----------------
Ref Before After
----------------------------------------------------------------------------------------
refs/heads/CLI-PS-Command-Shows-Tag-And-Branch | d80c38e9 | abea37b6
refs/heads/IBIS-15065-ibis70 | e7072a57 | 5fa674fa
refs/heads/IBIS-16015 | 91e27129 | b7d724e9
refs/heads/IBIS-16015_SUP20773 | db6ab9ff | 0e3e4bea
refs/heads/IBIS-17123 | 6240c520 | c5c80835
refs/heads/IBIS-17763 | fc30c283 | 658a4e1a
refs/heads/IBIS-18691_Suspended_Entries_disappear_while_migration | d9a2664e | d1d94242
refs/heads/IBIS-18800_PortalRelaseAfterFix | 6bc61c8d | 74667b55
refs/heads/IBIS-19245 | a5b22b93 | 6811dabd
refs/heads/IBIS-19367_70 | c9b55fef | 7662bb67
refs/heads/IBIS-19409_Merge_71 | 39c9ce35 | 78e3b4d4
refs/heads/IBIS-19409_Remove_Retry_Timeout_Validation | 08f0fbe4 | a6261048
refs/heads/IBIS-19686-sessionFixationValve-is61 | bf6a76d9 | 08785e1d
refs/heads/IBIS-20041-ibis61 | a5e0bd71 | cb907ae5
refs/heads/IBIS-20128 | 45f4d8d6 | e7502f69
...
Updating references: 100% (300/300)
...Ref update completed in 80 ms.
Commit Tree-Dirt History
------------------------
Earliest Latest
| |
.........................................Dm...DDDDDDDDDDDDDD
D = dirty commits (file tree fixed)
m = modified commits (commit message or parents changed)
. = clean commits (no changes to file tree)
Before After
-------------------------------------------
First modified commit | 8733298e | 6df4eda8
Last dirty commit | fa17594e | 64ad5e9c
Deleted files
-------------
Filename Git id
--------------------------------------------------------------------------------------
SystemBackupArchiveAS461.zip | 22107431 (461.6 MB)
SystemBackupArchiveAS470.zip | 9171cef4 (334.1 MB)
SystemBackupArchiveAS471.zip | c3cfc352 (284.7 MB)
SystemBackupArchiveTasksWaitings61.zip | 7a07cebc (523.1 MB)
SystemBackupArchiveTasksWaitings70.zip | 9dde5c99 (341.9 MB)
SystemBackupArchiveTasksWaitings71.zip | d6252b6d (306.4 MB)
backup61DiscontinuedPlugin.zip | 7f44976a (461.9 MB)
backup61WithUserSuspend.zip | 40b949e4 (453.1 MB)
backupXSLTConverter61.zip | 5c4dd7c9 (326.0 MB), c09da1e4 (467.1 MB)
distribution-1.0.0-SNAPSHOT.jar | 10bc3f1c (159.3 MB)
migration61to70backup.zip | af5d924c (490.5 MB), c595cfd9 (467.2 MB), ...
system-profiles-backup.zip | 373b5a98 (147.3 MB)
In total, 43855 object ids were changed. Full details are logged here:
some-big-repo.git.bfg-report/2015-12-16/16-30-47
BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive
Has the BFG saved you time? Support the BFG on BountySource: https://j.mp/fund-bfg
$ cd some-big-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
我可以看到我的本地仓库从6.4G缩小到1.4G。大。我现在尝试推送
$ git push
git push没有工作给了我这个错误信息:
Counting objects: 218648, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (81662/81662), done.
Writing objects: 100% (215818/215818), 666.89 MiB | 1.07 MiB/s, done.
Total 215818 (delta 119117), reused 210562 (delta 115381)
remote: Communication breakdown with Stash.
To ssh://git@example.com/some-big-repo.git
! [remote rejected] CLI-PS-Command-Shows-Tag-And-Branch -> CLI-PS-Command-Shows-Tag-And-Branch (pre-receive hook declined)
! [remote rejected] CUC-112 -> CUC-112 (pre-receive hook declined)
...
! [remote rejected] rc_7_0_0_9 -> rc_7_0_0_9 (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@example.com/some-big-repo.git'
后来我对我的回购做了一个新的克隆,这一次令我惊讶的是现在回购展示了更大的7.4G。我真的不确定这里发生了什么,需要输入来纠正这些事情。