Add change 16 to instructions
This commit is contained in:
23
how_to/Change_16.md
Normal file
23
how_to/Change_16.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
- commit: set parent to HEAD
|
||||||
|
|
||||||
|
When creating a new commit, we will use the HEAD to link the new commit to the
|
||||||
|
previous commit. We'll call the previous commit the "parent commit" and we will
|
||||||
|
save its OID in the "parent" key on the commit object.
|
||||||
|
|
||||||
|
For example, HEAD is currently bd0de093f1a0f90f54913d694a11cccf450bd990 and we
|
||||||
|
create a new commit, the new commit will look like this in the object store:
|
||||||
|
|
||||||
|
```
|
||||||
|
tree 50bed982245cd21e2798f179e0b032904398485b
|
||||||
|
parent bd0de093f1a0f90f54913d694a11cccf450bd990
|
||||||
|
|
||||||
|
This is the commit message!
|
||||||
|
```
|
||||||
|
|
||||||
|
The first commit in the repository will obviously have no parent.
|
||||||
|
|
||||||
|
Now we can retrieve the entire list of commits just by referencing the last
|
||||||
|
commit! We can start from the HEAD, read the "parent" key on the HEAD commit and
|
||||||
|
discover the commit before HEAD. Then read the parent of that commit, and go
|
||||||
|
back on and on... This is basically a linked list implemented over the object
|
||||||
|
database.
|
||||||
Reference in New Issue
Block a user