title = Moving branches around
cards = checkout commit-auto merge reset-hard

[description]

One of your colleagues messed up here, and put the branches in the wrong timelines!

You could delete and re-create these branches - but you can also directly move them to different commits, using `git reset --hard`.

The donut branch is in the right place, but the timeline is still incomplete.

[setup]

echo "You do not have a baguette.

You do not have coffee.

You do not have a donut." > you

git add .
git commit -m "The Beginning"

git checkout -b coffee
echo "You have a baguette.

You do not have coffee.

You do not have a donut." > you
git add .
git commit -m "You buy a baguette"

echo "You ate a baguette.

You do not have coffee.

You do not have a donut." > you
git add .
git commit -m "You eat the baguette"

git checkout -b baguette main
echo "You do not have a baguette.

You have coffee.

You do not have a donut." > you
git add .
git commit -m "You buy some coffee"

echo "You do not have a baguette.

You drank coffee.

You do not have a donut." > you
git add .
git commit -m "You drink the coffee"

git checkout -b donut main
echo "You do not have a baguette.

You do not have coffee.

You have a donut." > you
git add .
git commit -m "You buy a donut"

git checkout --detach main

[win]

# Did you eat a baguette on the baguette branch?
git show baguette:you | grep "You ate.*baguette"

# Did you drink a coffee on the coffee branch?
git show coffee:you | grep "You drank.*coffee"

# Did you eat a donut on the donut branch?
git show donut:you | grep "You ate.*donut"

[actions]

test "$(git rev-parse HEAD^)" = "$(git rev-parse donut)" && hint "Remember to checkout the blue branch tag when you want it to grow with the timeline."