oh-my-git/levels/shit-happens/restore-a-file

23 lines
459 B
Text
Raw Normal View History

title = Restore a deleted file
cards = checkout
2021-01-05 16:58:42 +01:00
[description]
Oops - you deleted the "essay" file, which you worked on all night!
2021-01-05 16:58:42 +01:00
Luckily, Git is here to help! You can use `git checkout` to restore the file!
2021-01-05 16:58:42 +01:00
[setup]
echo important > essay
2021-01-05 16:58:42 +01:00
git add .
git commit -m "Initial commit"
echo "important content" > essay
git commit -am "Improve essay"
rm essay
2021-01-05 16:58:42 +01:00
[win]
# Restore the essay to contain "important content"
test "$(cat essay)" = "important content"