oh-my-git/levels/index/new

29 lines
732 B
Text
Raw Permalink Normal View History

2021-01-05 12:46:07 +01:00
title = Add new files to the index
cards = add commit
2021-01-05 12:46:07 +01:00
[description]
But Git allows to you capture changes with more precision!
2021-01-05 12:46:07 +01:00
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`!
2021-01-05 12:46:07 +01:00
[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