我有一个腐败的git repo,我显然已经设法恢复(通过从遥控器中发送 select VendorId, [1] as R0,[2] as R1,[3] as R2,[4] as R3,[5] as R4
from (
select VendorId, QuotedAmount,
ROW_NUMBER () over (partition By VendorId order by QuotedAmount desc) as rn
from tbl_Vendor_Quotation
WHERE [ProductID] = 1) t1
PIVOT
(
max(QuotedAmount)
for rn in ([1],[2],[3],[4],[5])) As PivotTable
),因为我做到了这一点:
.git/objects
此时悬垂的斑点似乎是这些:
$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (7628/7628), done.
dangling blob ac27b1087864e0b313fed793521090cfc03c82cb
dangling blob 22aae8babcc61b3048557531c1550cb4fe33de93
dangling blob 62bd6159a9e19187a778c0ae5e7ef4f0b227197b
然而,当我尝试$ tree -p .git/objects/
.git/objects/
├── [drwxrwsr-x] 22
│ └── [-r--r--r--] aae8babcc61b3048557531c1550cb4fe33de93
├── [drwxrwsr-x] 62
│ └── [-r--r--r--] bd6159a9e19187a778c0ae5e7ef4f0b227197b
├── [drwxrwsr-x] ac
│ └── [-r--r--r--] 27b1087864e0b313fed793521090cfc03c82cb
├── [drwxrwsrwt] info
│ └── [-rw-rw-r--] packs
└── [drwxrwsrwt] pack
├── [-r--r--r--] pack-65f501f2463a843b574db1ac1bde89b44e9acf38.idx
└── [-r--r--r--] pack-65f501f2463a843b574db1ac1bde89b44e9acf38.pack
5 directories, 6 files
时,我明白了:
git gc --prune=today
好像$ git gc --prune=today
Counting objects: 7628, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1993/1993), done.
Writing objects: 100% (7628/7628), done.
Total 7628 (delta 5234), reused 7628 (delta 5234)
usage: git prune [-n] [-v] [--expire <time>] [--] [<head>...]
-n, --dry-run do not remove, show only
-v, --verbose report pruned objects
--progress show progress
--expire <expiry date>
expire objects older than <time>
error: failed to run prune
调用git gc ...
时出现语法错误?编辑:请注意,没有进一步参数的git prune
成功没有问题......
是否有快速方法让git gc
成功获得此回购?本地git gc --prune=today
版本为:
git
编辑:我删除了悬空blob文件:
$ git --version
git version 1.9.1
......我得到了这个:
$ rm -rf .git/objects/{22,62,ac}
...但$ git gc
Counting objects: 7628, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1993/1993), done.
Writing objects: 100% (7628/7628), done.
Total 7628 (delta 5234), reused 7628 (delta 5234)
$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (7628/7628), done.
仍然以同样的方式失败。是因为它找不到对象文件&#34; prune&#34;?
答案 0 :(得分:0)
修复:运行git gc --prune=now
git prune
理解--expire now
,但不能理解--expire today
。
这有点奇怪,因为git prune
理解yesterday
和0 day ago
(充当now
)。
这个问题很旧,错误消息有了一个改进。
从2.18版开始(于2018年6月发布):
Git 2.18发行说明
[...]
- “ git gc --prune =废话”花了很长时间重新包装,然后 基础“ git prune --expire =废话”时,静默失败 无法解析其命令行。这已得到纠正。
错误消息现在看起来像:
$ git gc --prune=today
fatal: failed to parse prune expiry value today