shit-happens chapter :P

This commit is contained in:
blinry 2021-01-05 16:58:42 +01:00
parent 9109394271
commit 12ea306302
7 changed files with 169 additions and 0 deletions
levels/shit-happens

View file

@ -0,0 +1,21 @@
title = Restore a file from the past
cards = checkout checkout-from commit
[description]
Here's a similar problem: you really liked the essay from the very first commit, and want to have it back! Well, checkout can also restore things from older commits, Here's how:
git checkout [commit] [file]
[setup]
echo "good version" > essay
git add .
git commit -m "Initial commit"
echo "bad version" > essay
git commit -am "\"Improve\" essay"
[win]
# Get the first version of your essay, and make a new commit with it.
test "$(git show main:essay)" = "good version"