mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +02:00
finished the mechanism for setting the language
This commit is contained in:
parent
705cc849c2
commit
50ee071f0e
214 changed files with 94 additions and 10 deletions
levels/en_EN/low-level
37
levels/en_EN/low-level/index-add
Normal file
37
levels/en_EN/low-level/index-add
Normal file
|
@ -0,0 +1,37 @@
|
|||
[description]
|
||||
|
||||
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"?
|
||||
|
||||
[congrats]
|
||||
|
||||
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! :)
|
||||
|
||||
[setup]
|
||||
|
||||
[setup goal]
|
||||
|
||||
echo "file 1" > file1
|
||||
echo "file 2" > file2
|
||||
echo "file 3" > file3
|
||||
git add .
|
||||
|
||||
[win]
|
||||
|
||||
test "$(git ls-files | wc -l)" -ge 3
|
Loading…
Add table
Add a link
Reference in a new issue