mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
28 lines
732 B
Text
28 lines
732 B
Text
title = Looking into the past
|
|
cards = checkout-from
|
|
|
|
[description]
|
|
|
|
You've been working on your essay for a while. But you're not happy with the changes you've made recently. You want to go back to the version called "Best version"!
|
|
|
|
No problem, you can use the `checkout` card to restore your essay from an older commit!
|
|
|
|
[setup]
|
|
|
|
echo "Initial version" > essay.txt
|
|
git add .
|
|
git commit -m "Initial commit"
|
|
|
|
echo "Improved version" > essay.txt
|
|
git commit -a -m "Improved version"
|
|
|
|
echo "Best version" > essay.txt
|
|
git commit -a -m "Best version"
|
|
|
|
echo "Less-good version" > essay.txt
|
|
git commit -a -m "Less-good version"
|
|
|
|
[win]
|
|
|
|
# For nostalgic reasons, restore the very first backup you made!
|
|
diff essay.txt <(echo "Best version")
|