git add未commit reset恢复文件
# git fsck > files.txt
获取到所有悬挂的文件,将悬挂的文件名称存入files.txt中,文件内容如下
dangling blob d6bf40c9f290161c87230787a1056d977d36c821
dangling blob d61f00d8cad3920809f4d992ac3031b3f32e7f10
dangling blob d7af99b5e2ae9a21d534f1965c35a2b572143322
dangling blob d96f555491868caffb665c2dd391108abfcac581
dangling blob da2f86e1710b8539b8047e4452f1ff6cb0e1f211
dangling blob e0dfd04e4d3fcbaa6588c8cbb9e9065609bcb862
dangling blob e06f361eb6d429290806b9f9cd7a0aebce22be4d
dangling blob e2bfcf6c21b1b9116459e2213b0bd9b5f52b4b67
dangling blob e23f0b42283d43c029f747596ed573859c917876
dangling blob e3dfe04304e451a9a75a46fd0d052279f601f09d
dangling blob f50fc6c14e67a228c4ba9a61b1357c16410e8228
dangling blob f55f1b358726d8f23b1a2e57bee6863387bd7ad4
dangling blob fe4f6f5494085ec15a05838bdf793f3ef0532f5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
删除掉"dangling blob",使其变成
d6bf40c9f290161c87230787a1056d977d36c821
d61f00d8cad3920809f4d992ac3031b3f32e7f10
d7af99b5e2ae9a21d534f1965c35a2b572143322
d96f555491868caffb665c2dd391108abfcac581
da2f86e1710b8539b8047e4452f1ff6cb0e1f211
e0dfd04e4d3fcbaa6588c8cbb9e9065609bcb862
e06f361eb6d429290806b9f9cd7a0aebce22be4d
e2bfcf6c21b1b9116459e2213b0bd9b5f52b4b67
e23f0b42283d43c029f747596ed573859c917876
e3dfe04304e451a9a75a46fd0d052279f601f09d
f50fc6c14e67a228c4ba9a61b1357c16410e8228
f55f1b358726d8f23b1a2e57bee6863387bd7ad4
fe4f6f5494085ec15a05838bdf793f3ef0532f5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# 将blob字节文件还原为原文
#!/bin/bash
for line in `cat files.txt`
do
echo "File:${line}"
git show ${line} > files/${line}.txt
done
1
2
3
4
5
6
2
3
4
5
6
上次更新: 2023/10/16, 17:53:06 访问次数: 0