More polish for the index level

This commit is contained in:
blinry 2021-02-04 12:01:58 +01:00
parent 4f4857bdf6
commit a86fcaadbb
6 changed files with 44 additions and 25 deletions
levels/index

View file

@ -3,30 +3,35 @@ cards = add reset-file commit
[description]
See the dark shadow behind the icons? That's the version of the commit you're at!
See the dark shadow behind the icons? That's the version of the file in the last commit!
For example, these candles have been blown out, and that change has been added.
But you decide that this was a mistake! You only want to blow out the red candle in the next commit!
If you already have updated the index to a changed file, but want to reset it, you can use `git reset`!
[setup]
echo a > a
echo b > b
echo c > c
echo "It's burning!" > red_candle
echo "It's burning!" > green_candle
echo "It's burning!" > blue_candle
git add .
git commit -m "Initial commit"
echo x > a
echo x > b
echo x > c
git commit -m "The beginning"
echo "It's been blown out." > red_candle
echo "It's been blown out." > green_candle
echo "It's been blown out." > blue_candle
git add .
[win]
# Reset the changes in a and c
test "$(git show :a)" == "a" &&
test "$(git show :b)" != "a" &&
test "$(git show :c)" == "c"
# Reset the changes in the green and blue candles!
git show :green_candle | grep burning &&
git show :blue_candle | grep burning &&
git show :red_candle | grep -v burning
# And make a commit!
test "$(git show main:a)" == "a" &&
test "$(git show main:b)" != "b" &&
test "$(git show main:c)" == "c"
git show main:green_candle | grep burning &&
git show main:blue_candle | grep burning &&
git show main:red_candle | grep -v burning