2020-09-15 22:35:14 +02:00
|
|
|
Blobs usually represent the content of a file. But on their own, they don't have any metadata, not even a name!
|
|
|
|
|
2020-09-16 16:16:11 +02:00
|
|
|
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.
|
2020-09-15 22:35:14 +02:00
|
|
|
|
2020-09-16 16:16:11 +02:00
|
|
|
The most convenient option to add an entry to the index is via an existing file:
|
2020-09-15 22:35:14 +02:00
|
|
|
|
2020-09-16 16:16:11 +02:00
|
|
|
echo "my content" > file
|
|
|
|
git update-index --add file
|
2020-09-15 22:35:14 +02:00
|
|
|
|
|
|
|
Add three entries to the index! For a bonus challenge: can you add a file that is inside of a directory, like "directory/file"?
|