oh-my-git/levels/index/reset
2021-01-11 19:16:35 +01:00

33 lines
651 B
Plaintext

title = Resetting files in the index
cards = add reset commit
[description]
See the dark shadow behind the icons? That's the version of the commit you're at!
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
git add .
git commit -m "Initial commit"
echo x > a
echo x > b
echo x > c
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"
# And make a commit!
test "$(git show main:a)" == "a" &&
test "$(git show main:b)" != "b" &&
test "$(git show main:c)" == "c"