Initialize a new git repo in a folder
Create a file called diary.txt
. Inside the file, add the following:
I love my boss
Add and commit the changes on the master
branch
Create a new branch called the-truth
. Switch to it.
In the diary.txt
file, erase the contents and instead replace it with:
I HATE MY BOSS
I HATE MY BOSS
I HATE MY BOSS
I HATE MY BOSS
I HATE MY BOSS
Save the file
OH NO! Your boss is walking towards you! Quick, switch over to the master
branch!
WHATTT? The diary.txt
file still contains our confession? Quick, stash the changes before your boss sees!!
Your diary.txt
file should now only contain "I love my boss"
As your boss walks by, add more lies to the diary.txt
file:
I love my boss
I love my boss
I love my boss
Add and commit your changes on the master
branch.
Now that your boss has left, it's safe to get back to the truth! Switch over to the the-truth
branch.
Retrieve the earlier changes that you stashed (I HATE MY BOSS x 5)
Add and commit the changes on the the-truth
branch