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
The `-w` tells `hash-object` to store the object; otherwise, the command simply tells you what the key would be.
34
-
`--stdin` tells the command to read the content from stdin; if you don't specify this, `hash-object` expects the path to a file.
34
+
`--stdin` tells the command to read the content from stdin; if you don't specify this, `hash-object` expects a file path at the end.
35
35
The output from the command is a 40-character checksum hash.
36
36
This is the SHA-1 hash – a checksum of the content you're storing plus a header, which you'll learn about in a bit.
37
37
Now you can see how Git has stored your data:
@@ -121,7 +121,7 @@ The next type we'll look at is the tree, which solves the problem of storing the
121
121
Git stores content in a manner similar to a UNIX filesystem, but a bit simplified.
122
122
All the content is stored as tree and blob objects, with trees corresponding to UNIX directory entries and blobs corresponding more or less to inodes or file contents.
123
123
A single tree object contains one or more tree entries, each of which contains a SHA-1 pointer to a blob or subtree with its associated mode, type, and filename.
124
-
For example, the most recent tree in the simplegit project may look something like this:
124
+
For example, the most recent tree in the a project may look something like this:
125
125
126
126
[source,shell]
127
127
----
@@ -145,8 +145,8 @@ Conceptually, the data that Git is storing is something like this:
145
145
.Simple version of the Git data model.
146
146
image::images/data-model-1.png[Simple version of the Git data model.]
147
147
148
-
You can create your own tree.
149
-
Git normally creates a tree by taking the state of your staging area or index and writing a tree object from it.
148
+
You can fairly easily create your own tree.
149
+
Git normally creates a tree by taking the state of your staging area or index and writing a series of tree objects from it.
150
150
So, to create a tree object, you first have to set up an index by staging some files.
151
151
To create an index with a single entry – the first version of your text.txt file – you can use the plumbing command `update-index`.
152
152
You use this command to artificially add the earlier version of the test.txt file to a new staging area.
You've just done the low-level operations to build up a Git history without using any of the front ends.
303
+
You've just done the low-level operations to build up a Git history without using any of the front end commands.
304
304
This is essentially what Git does when you run the `git add` and `git commit` commands – it stores blobs for the files that have changed, updates the index, writes out trees, and writes commit objects that reference the top-level trees and the commits that came immediately before them.
305
305
These three main Git objects – the blob, the tree, and the commit – are initially stored as separate files in your `.git/objects` directory.
306
306
Here are all the objects in the example directory now, commented with what they store:
0 commit comments