Rename chapters into "internals" and "intro"

This commit is contained in:
Sebastian Morr 2020-10-01 15:03:02 +02:00
parent 70fe577788
commit f3ff5c5147
97 changed files with 0 additions and 0 deletions
levels/internals/index-add

View file

@ -0,0 +1,9 @@
There's another way to add an entry to the index directly:
git update-index --add --cacheinfo <mode>,<blobhash>,<name>
The first three numbers of the mode describe the type of the entry, "100" is a regular file.
The second three number describe the permissions. Only "644" (non-executable) and "755" (executable) are supported.
You can insert the hash of an object into the terminal by right-clicking on it! :)

View file

@ -0,0 +1,10 @@
Blobs usually represent the content of a file. But on their own, they don't have any metadata, not even a name!
Git has a very powerful concept to store metadata related to blobs: the index! It's a list that relates blobs to filenames and access permissions.
The most convenient option to add an entry to the index is via an existing file:
echo "my content" > file
git update-index --add file
Add three entries to the index! For a bonus challenge: can you add a file that is inside of a directory, like "directory/file"?

View file

@ -0,0 +1,4 @@
echo "file 1" > file1
echo "file 2" > file2
echo "file 3" > file3
git add .

View file

View file

@ -0,0 +1 @@
test "$(git ls-files | wc -l)" -ge 3