mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +02:00
Rename chapters into "internals" and "intro"
This commit is contained in:
parent
70fe577788
commit
f3ff5c5147
97 changed files with 0 additions and 0 deletions
levels/internals/index-add
9
levels/internals/index-add/congrats
Normal file
9
levels/internals/index-add/congrats
Normal 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! :)
|
10
levels/internals/index-add/description
Normal file
10
levels/internals/index-add/description
Normal 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"?
|
4
levels/internals/index-add/goal
Normal file
4
levels/internals/index-add/goal
Normal file
|
@ -0,0 +1,4 @@
|
|||
echo "file 1" > file1
|
||||
echo "file 2" > file2
|
||||
echo "file 3" > file3
|
||||
git add .
|
0
levels/internals/index-add/start
Normal file
0
levels/internals/index-add/start
Normal file
1
levels/internals/index-add/win
Normal file
1
levels/internals/index-add/win
Normal file
|
@ -0,0 +1 @@
|
|||
test "$(git ls-files | wc -l)" -ge 3
|
Loading…
Add table
Add a link
Reference in a new issue