2. Save the cool automated things
Would be a shame if someone were to delete that thing you spent 5 hours on.
When you type things into Google docs, it autosaves and you can see the version history.
What if we want to see the version history of our file? What if we want to have multiple versions of the file without having multiple copies? What if we want to let others change our file without over-writing our changes?
Git solves these problems for us. Let's use it.
Experience Git Visually
Just like we learned how to move first inside Linux, we'll learn to move with Git.
Let's have some fun with this Git Visualizer first and find out it is :)
Making commits
You'll see a new bubble. Bubbles are fun, let's make another one.
You'll see another bubble. Nice.
Do this as many times as you like to see more commits.
See history
This is the history of the commits you've made so far, similar to the version history of a Google Doc.
We can see that the first commit has a message, that says first commit
. The commits after don't have messages.
Commit with messages
Let's start over. Press 'OK' for the browser popup after running the command.
Now, we've all got that one friend that claims that they've got a degree in rizzology. Somehow, this one friend always happens to be the single one.
One day, your friend tells you they have a crush on someone.
You give your friend all the advice you can, and they still completely goof it up.
We ask our friend if they're using git, and they're not. No wonder why their crush left them on read. Your friend says:
But git's so hard to learn ๐ญ
What do you do? Well of course, you just hit 'em with the good old....
Plenty of fish in sea ๐๏ธ
It hasn't even been two weeks, and your friend has a crush on another person.
Your friend shows you their crushes' instagram, and let's be honest, you don't really care. But you want to be a good friend so you roll with it.
As friends always do, they hit you with the good old:
Oh it's just a bad picture I swear they look better in real life
You're curious so you look at it.
UH OH
Oh no, your friend's crush's friend do be looking kinda cute. ๐ถ
So you start gassing up your friend and asking them to text their crush, and they hit you with:
I'm not following your advice and getting left on read again
Now, that's outrageous ๐ก
To be honest, git do be a little initimidating. And you care about our friend. You don't want them to goof up again. A win for your friend is a win for you, right?.
So we're going to show them how rizzology is done right using git.
Let's get to work and text our friend's crush.
Huh? ๐คจ
Your friend is excited that your rizzology degree is paying off, and you made their crush lol.
But deep down, you know you didn't say anything funny. You're a little worried.๐ค
Time to investigate. Let's put on our hacker hoodies, and find out.
UH OH
We put a 'hbu' at the end ๐ฑ Whoops ๐ฌ
๐จ You scramble. ๐จ
GG. You embarrassed yourself, and you're also about to get your friend left on read.๐
Your friend starts to panic, and you tell them to calm down.
Git to the rescue. Let's show our friend its time travel powers.
Resetting commits
We need to pick a point in time to travel back to and try to un-oopsie this.
It doesn't work. And your friend panics, as friends always do.
Looking closer at the log we notice that each commit has a hash identifier.
Let's find the hash of pretty good hbu
and reset to it.
Bingo. The hash is pretty long, but it looks like it's unique.
Let's try just the first three characters.
Did it work? Let's check.
Okay, looks like that worked. Phew. ๐
Renaming commits
Now let's quickly fix our oopsie.
You'll see that the previous commit turned white, and a new one appeared at the same level.
We've erased the white commits forever, or have we? Time will tell.
Resetting commits
Time elapses, and it tells nothing. Our friend's crush doesn't reply.
This is concerning. The imposter syndrome starts to hit you.
Are you truly a rizzologist? Is it truly GG? ๐ฐ
Let's find out.
Looking at the conversation, you start to feel very thirsty. ๐ต
UH OH
๐จ Houston, we got a very dry conversation. ๐จ
Quick quick, let's see if they'll be at hack the tunnels.
With our rizzology skills, let's abbreviate it so that they they can't help but reply when they read it.
You get a reply.
Phew. Looks, like your friend won't doubt your rizzology skills after all.
To be continued...
Last updated on