-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-alldetails
187 lines (162 loc) · 4.44 KB
/
git-alldetails
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/bash
# Useful commands for the talk
# $env:Path += ";$(Resolve-Path .)"
# C:\Program Files\Git\bin\sh.exe
# cat right.txt > left.txt && git alldetails > right.txt
##########################################################################################################
echo "==========="
echo "= List Files in '.git' [ find .git/ -type f ]"
echo "==========="
echo ""
find .git/ -type f
echo ""
##########################################################################################################
echo "==========="
echo "= All Objects [ git cat-file --batch-check --batch-all-objects ]"
echo "==========="
echo ""
git cat-file --batch-check --batch-all-objects
echo ""
##########################################################################################################
commits=$(git cat-file --batch-check --batch-all-objects | grep commit | cut -d' ' -f 1)
trees=$(git cat-file --batch-check --batch-all-objects | grep tree | cut -d' ' -f 1)
blobs=$(git cat-file --batch-check --batch-all-objects | grep blob | cut -d' ' -f 1)
echo "==========="
echo "= Blobs [ git cat-file --batch-check --batch-all-objects | grep blob"
echo "==========="
echo ""
for blob in $blobs
do
echo "-----------"
echo "- $blob [ git cat-file -p $blob ]"
echo "-----------"
echo ""
git cat-file -p $blob
echo ""
echo ""
done
echo "==========="
echo "= Trees [ git cat-file --batch-check --batch-all-objects | grep tree"
echo "==========="
echo ""
for tree in $trees
do
echo "-----------"
echo "- $tree [ git cat-file -p $tree ]"
echo "-----------"
echo ""
git cat-file -p $tree
echo ""
done
echo ""
echo "==========="
echo "= Commits [ git cat-file --batch-check --batch-all-objects | grep commit ]"
echo "==========="
echo ""
for commit in $commits
do
echo "-----------"
echo "- $commit [ git cat-file -p $commit ]"
echo "-----------"
echo ""
git cat-file -p $commit
echo ""
done
echo ""
##########################################################################################################
# echo "==========="
# echo "= Log [ git --no-pager log --pretty=oneline --graph --all --decorate=full ]"
# echo "==========="
# echo ""
# git --no-pager log --pretty=oneline --graph --all --decorate=full
# echo ""
##########################################################################################################
# echo "==========="
# echo "= Index"
# echo "==========="
# echo ""
# echo "-----------"
# echo "- Staged [ git ls-files -s ]"
# echo "-----------"
# echo ""
# git ls-files -s
# echo ""
# echo "-----------"
# echo "- Modified [ git ls-files -m ]"
# echo "-----------"
# echo ""
# git ls-files -m
# echo ""
# echo "-----------"
# echo "- Deleted [ git ls-files -d ]"
# echo "-----------"
# echo ""
# git ls-files -d
# echo ""
# echo "-----------"
# echo "- Unmerged [ git ls-files -u ]"
# echo "-----------"
# echo ""
# git ls-files -u
# echo ""
# echo "-----------"
# echo "- Others/Untracked [ git ls-files -o --exclude-standard ]"
# echo "-----------"
# echo ""
# git ls-files -o --exclude-standard
# echo ""
##########################################################################################################
# echo "==========="
# echo "= References [ git show-ref --head ]"
# echo "==========="
# echo ""
# git show-ref --head
# echo ""
# echo "==========="
# echo "= Contents of reference files"
# echo "==========="
# echo ""
# echo "-----------"
# echo "- .git/HEAD [ cat .git/HEAD ]"
# echo "-----------"
# echo ""
# cat .git/HEAD
# echo ""
# refpaths=$(find .git/refs/ -type f)
# for refpath in $refpaths
# do
# echo "-----------"
# echo "- $refpath"
# echo "-----------"
# echo ""
# cat $refpath
# echo ""
# done
##########################################################################################################
# echo "==========="
# echo "= Reflog (HEAD) [ git reflog ]"
# echo "==========="
# echo ""
# git reflog
# echo ""
# echo "==========="
# echo "= Contents of log files"
# echo "==========="
# echo ""
# logpaths=$(find .git/logs/ -type f)
# for logpath in $logpaths
# do
# echo "-----------"
# echo "- $logpath"
# echo "-----------"
# echo ""
# cat $logpath
# echo ""
# done
##########################################################################################################
# echo "==========="
# echo "= Verify database [ git fsck --unreachable --no-reflog ]"
# echo "==========="
# echo ""
# git fsck --unreachable --no-reflog
# echo ""