mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-03 19:04:40 +01:00
77 lines
1.6 KiB
Text
77 lines
1.6 KiB
Text
title = Reordering events
|
|
cards = checkout commit-auto reset-hard rebase-interactive cherry-pick
|
|
|
|
[description]
|
|
|
|
Oops, looks like there's something messed up here. Can you put the events back into their correct order?
|
|
|
|
There are two ways to do this: You can drag the "interactive rebase" card to the commit before the one you want to change, then reorder the lines in the file that opens, and save it.
|
|
|
|
Or you can reset the main tag to the very first commit, and then cherry-pick single commits in the order you want. You have cards for both approaches!
|
|
|
|
[setup]
|
|
|
|
echo "You just woke up.
|
|
|
|
You are NOT wearing underwear.
|
|
|
|
You are NOT wearing pants.
|
|
|
|
You are NOT wearing a shirt.
|
|
|
|
You are NOT wearing shoes." > you
|
|
git add .
|
|
|
|
git commit -m "The Beginning"
|
|
|
|
echo "You just woke up.
|
|
|
|
You are NOT wearing underwear.
|
|
|
|
You are NOT wearing pants.
|
|
|
|
You are NOT wearing a shirt.
|
|
|
|
You are wearing shoes." > you
|
|
git commit -am "Put on shoes"
|
|
|
|
echo "You just woke up.
|
|
|
|
You are NOT wearing underwear.
|
|
|
|
You are wearing pants.
|
|
|
|
You are NOT wearing a shirt.
|
|
|
|
You are wearing shoes." > you
|
|
git commit -am "Put on pants"
|
|
|
|
echo "You just woke up.
|
|
|
|
You are wearing underwear.
|
|
|
|
You are wearing pants.
|
|
|
|
You are NOT wearing a shirt.
|
|
|
|
You are wearing shoes." > you
|
|
git commit -am "Put on underwear"
|
|
|
|
echo "You just woke up.
|
|
|
|
You are wearing underwear.
|
|
|
|
You are wearing pants.
|
|
|
|
You are wearing a shirt.
|
|
|
|
You are wearing shoes." > you
|
|
git commit -am "Put on shirt"
|
|
|
|
[win]
|
|
|
|
{ git log main --oneline | grep -Pz "shoes[\s\S]*pants[\s\S]*underwear"; } && { test "$(git log main --oneline | wc -l)" -eq 5; }
|
|
|
|
[congrats]
|
|
|
|
Feel free to reset the level and try the other strategy! Which one do you like better?
|