mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
28 lines
732 B
Text
28 lines
732 B
Text
title = Add new files to the index
|
|
cards = add commit
|
|
|
|
[description]
|
|
|
|
But Git allows to you capture changes with more precision!
|
|
|
|
To understand how to do that, you need to learn about [your teacher raises her voice dramatically] *the index*!
|
|
|
|
In the index, we can prepare what will be in the next commit. In this game, the index is represented by a blue aura!
|
|
|
|
Initially, all files are untracked. If you have a file, and you want to have it in the next commit, use `git add`!
|
|
|
|
Here, we don't use the fancy commit card, but a plain `git commit`!
|
|
|
|
[setup]
|
|
|
|
echo a > a
|
|
echo b > b
|
|
echo c > c
|
|
|
|
[win]
|
|
|
|
# Add all three files to the index.
|
|
test "$(git ls-files | wc -l)" -eq 3
|
|
|
|
# And make a commit.
|
|
test "$(git ls-tree main | wc -l)" -eq 3
|