2020-10-12 20:09:51 +02:00
|
|
|
title = Looking into the past
|
|
|
|
|
2020-10-06 10:51:12 +02:00
|
|
|
[description]
|
|
|
|
|
|
|
|
You've been working on your essay for a while. But - ughh! Now your cat walks over your keyboard and "helps you", so now it's all messed up again! :/
|
|
|
|
|
|
|
|
To restore your essay from the last backup, type:
|
|
|
|
|
2020-10-12 18:12:12 +02:00
|
|
|
git checkout essay.txt
|
2020-10-06 10:51:12 +02:00
|
|
|
|
|
|
|
To restore an older version, for example, from two backups before the latest one, type:
|
|
|
|
|
2020-10-12 18:12:12 +02:00
|
|
|
git checkout HEAD~2 essay.txt
|
2020-10-06 10:51:12 +02:00
|
|
|
|
|
|
|
For nostalgic reasons, restore the very first backup you made!
|
|
|
|
|
|
|
|
[setup]
|
|
|
|
|
|
|
|
echo "A" >> essay.txt
|
|
|
|
git add .
|
|
|
|
git commit -m "Initial commit"
|
|
|
|
|
|
|
|
echo "B" >> essay.txt
|
|
|
|
git commit -a -m "Improved version"
|
|
|
|
|
|
|
|
echo "C" >> essay.txt
|
|
|
|
git commit -a -m "Even better version"
|
|
|
|
|
|
|
|
echo "D" >> essay.txt
|
|
|
|
git commit -a -m "Marvelous version"
|
|
|
|
|
|
|
|
echo "blarg
|
|
|
|
blaaaargh" > essay.txt
|
|
|
|
|
|
|
|
[win]
|
|
|
|
|
|
|
|
diff essay.txt <(echo "A")
|