oh-my-git/levels/index/reset

33 lines
651 B
Text
Raw Normal View History

2021-01-05 12:46:07 +01:00
title = Resetting files in the index
cards = add reset commit
2021-01-05 12:46:07 +01:00
[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`!
2021-01-05 12:46:07 +01:00
[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
2021-01-05 12:46:07 +01:00
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"