mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
Tweaks to "shit-happens", like an ordering
This commit is contained in:
parent
12ea306302
commit
779d03416f
3 changed files with 24 additions and 19 deletions
|
@ -1,21 +1,22 @@
|
||||||
title = Restore a file from the past
|
title = Restore a deleted file
|
||||||
cards = checkout checkout-from commit
|
cards = checkout
|
||||||
|
|
||||||
[description]
|
[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:
|
Oops - you deleted the "essay" file, which you worked on all night!
|
||||||
|
|
||||||
git checkout [commit] [file]
|
Luckily, Git is here to help! You can use `git checkout` to restore the file!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "good version" > essay
|
echo important > essay
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Initial commit"
|
git commit -m "Initial commit"
|
||||||
echo "bad version" > essay
|
echo "important content" > essay
|
||||||
git commit -am "\"Improve\" essay"
|
git commit -am "Improve essay"
|
||||||
|
rm essay
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
# Get the first version of your essay, and make a new commit with it.
|
# Restore the essay to contain "important content"
|
||||||
test "$(git show main:essay)" = "good version"
|
test "$(cat essay)" = "important content"
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
title = Restore a deleted file
|
title = Restore a file from the past
|
||||||
cards = checkout
|
cards = checkout checkout-from commit
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
Oops - you deleted the "essay" file, which you worked on all night!
|
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:
|
||||||
|
|
||||||
Luckily, Git is here to help! You can use `git checkout` to restore the file!
|
git checkout [commit] [file]
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo important > essay
|
echo "good version" > essay
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Initial commit"
|
git commit -m "Initial commit"
|
||||||
echo "important content" > essay
|
echo "bad version" > essay
|
||||||
git commit -am "Improve essay"
|
git commit -am "\"Improve\" essay"
|
||||||
rm essay
|
|
||||||
|
|
||||||
[win]
|
[win]
|
||||||
|
|
||||||
# Make changes to all three files, and add all of them to the index.
|
# Get the first version of your essay, and make a new commit with it.
|
||||||
test "$(cat essay)" = "important content"
|
test "$(git show main:essay)" = "good version"
|
||||||
|
|
5
levels/shit-happens/sequence
Normal file
5
levels/shit-happens/sequence
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
restore-a-file
|
||||||
|
restore-a-file-from-the-past
|
||||||
|
bad-commit
|
||||||
|
pushed-something-broken
|
||||||
|
reflog
|
Loading…
Reference in a new issue