mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-07 05:02:04 +02:00
Rework levels, and add some new ones
This commit is contained in:
parent
931e9b3beb
commit
35b4dc098a
47 changed files with 163 additions and 39 deletions
levels/index-add
10
levels/index-add/description
Normal file
10
levels/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 permissions.
|
||||
|
||||
Even though it is possible to add an entry directly to the index, it's much more convenient to do it 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/index-add/goal
Normal file
4
levels/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/index-add/start
Normal file
0
levels/index-add/start
Normal file
1
levels/index-add/win
Normal file
1
levels/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