mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-24 16:20:08 +01:00
24 lines
649 B
Text
24 lines
649 B
Text
|
title = One step after another
|
||
|
cards = checkout commit reset-hard add
|
||
|
|
||
|
[description]
|
||
|
|
||
|
Sometimes, you might want to record the order in which things changed, instead of making a single commit.
|
||
|
|
||
|
What happened here? Make two commits from the changes (using the "add" card), in an order that makes sense!
|
||
|
|
||
|
[setup]
|
||
|
|
||
|
echo something > file1
|
||
|
echo something else > file2
|
||
|
git add .
|
||
|
git commit -m "Initial commit"
|
||
|
|
||
|
echo this should happen first >> file1
|
||
|
echo and this should happen after that >> file2
|
||
|
|
||
|
[win]
|
||
|
|
||
|
test "$(git diff-tree --no-commit-id --name-status -r main)" = "M file2" &&
|
||
|
test "$(git diff-tree --no-commit-id --name-status -r main^)" = "M file1"
|