2021-01-05 17:14:50 +01:00
|
|
|
title = Restore a deleted file
|
|
|
|
cards = checkout
|
2021-01-05 16:58:42 +01:00
|
|
|
|
|
|
|
[description]
|
|
|
|
|
2021-01-05 17:14:50 +01:00
|
|
|
Oops - you deleted the "essay" file, which you worked on all night!
|
2021-01-05 16:58:42 +01:00
|
|
|
|
2021-01-05 17:14:50 +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]
|
|
|
|
|
2021-01-05 17:14:50 +01:00
|
|
|
echo important > essay
|
2021-01-05 16:58:42 +01:00
|
|
|
git add .
|
|
|
|
git commit -m "Initial commit"
|
2021-01-05 17:14:50 +01:00
|
|
|
echo "important content" > essay
|
|
|
|
git commit -am "Improve essay"
|
|
|
|
rm essay
|
2021-01-05 16:58:42 +01:00
|
|
|
|
|
|
|
[win]
|
|
|
|
|
2021-01-05 17:14:50 +01:00
|
|
|
# Restore the essay to contain "important content"
|
|
|
|
test "$(cat essay)" = "important content"
|