You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/10-git-internals/sections/packfiles.asc
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
=== Packfiles
2
2
3
-
Let's go back to the object database for your test Git repository.
4
-
At this point, you have 11 objects – 4 blobs, 3 trees, 3 commits, and 1 tag:
3
+
If you followed all of the instructions in the example from the previous section, you should now have a test Git repository with 11 objects -- four blobs, three trees, three commits, and one tag:
5
4
6
5
[source,console]
7
6
----
@@ -20,8 +19,8 @@ $ find .git/objects -type f
20
19
----
21
20
22
21
Git compresses the contents of these files with zlib, and you're not storing much, so all these files collectively take up only 925 bytes.
23
-
You'll add some larger content to the repository to demonstrate an interesting feature of Git.
24
-
To demonstrate, we'll add the `repo.rb` file from the Grit library – this is about a 22K source code file:
22
+
Now you'll add some more sizable content to the repository to demonstrate an interesting feature of Git.
23
+
To demonstrate, we'll add the `repo.rb` file from the Grit library -- this is about a 22K source code file:
25
24
26
25
[source,console]
27
26
----
@@ -36,7 +35,7 @@ $ git commit -m 'added repo.rb'
36
35
rewrite test.txt (100%)
37
36
----
38
37
39
-
If you look at the resulting tree, you can see the SHA-1 value your `repo.rb` file got for the blob object:
38
+
If you look at the resulting tree, you can see the SHA-1 value that was calculated for your new `repo.rb` blob object:
The objects that remain are the blobs that aren't pointed to by any commit – in this case, the ``what is up, doc?'' example and the ``test content'' example blobs you created earlier.
115
+
The objects that remain are the blobs that aren't pointed to by any commit -- in this case, the ``what is up, doc?'' example and the ``test content'' example blobs you created earlier.
117
116
Because you never added them to any commits, they're considered dangling and aren't packed up in your new packfile.
118
117
119
118
The other files are your new packfile and an index.
@@ -158,7 +157,7 @@ chain length = 1: 3 objects
158
157
159
158
Here, the `033b4` blob, which if you remember was the first version of your `repo.rb` file, is referencing the `b042a` blob, which was the second version of the file.
160
159
The third column in the output is the size of the object in the pack, so you can see that `b042a` takes up 22K of the file, but that `033b4` only takes up 9 bytes.
161
-
What is also interesting is that the second version of the file is the one that is stored intact, whereas the original version is stored as a delta – this is because you're most likely to need faster access to the most recent version of the file.
160
+
What is also interesting is that the second version of the file is the one that is stored intact, whereas the original version is stored as a delta -- this is because you're most likely to need faster access to the most recent version of the file.
162
161
163
162
The really nice thing about this is that it can be repacked at any time.
164
163
Git will occasionally repack your database automatically, always trying to save more space, but you can also manually repack at any time by running `git gc` by hand.
0 commit comments