

Alright.
Gather round, class.
What's this then?
It's Git.
Git?
Like a silly person?
No,
version control.
Right,
your directory is a repository.
A repo.
A what now?
Where your code lives.
So I just save it?
No, you stage it first.
Git add.
Then you commit it.
Like a promise.
Ah, with a little message.
Git commit hyphen m.
Proper, innit?
BRANCH IT! COMMIT IT!
PUSH IT! PULL!
KEEP THE HISTORY, THAT’S THE RULE!
(keep the history!)
BRANCH IT! COMMIT IT!
PUSH IT! PULL! KEEP THE HISTORY,
THAT’S THE RULE!
Start
on the main line,
tracking the source But you want a new feature,
a different course Don't write on the main,
that's a dangerous dance Git branch new-feature,
give your ideas a chance!
(Aye, safety first!)
So I've got this branch.
How do I get it back?
You merge it, mate.
What if we both edited line ninety-nine?
Ah. The dreaded merge conflict.
(Oh blimey!)
Use Git diff to see who made the absolute mess.
It was probably him.
Oi!
It was not!
BRANCH IT! COMMIT IT!
PUSH IT! PULL!
KEEP THE HISTORY, THAT’S THE RULE!
(yes indeed!) BRANCH IT!
COMMIT IT! PUSH IT!
PULL! KEEP THE HISTORY,
THAT’S THE RULE!
Now we go remote,
far away on the web
GitHub or GitLab, flow with the ebb
Git push sends your commits up to the sky Git pull brings
down what the others supply Keep it in sync or your workflow
will die!
(In sync now!)
And now,
a word about Git revert.
When you've completely ruined your Friday afternoon.
Let's get this straight then.
We use tags for versions,
like v-one-point-oh. We pull the remote before we start to blow.
We write clean commits so the history stays pure.
No more files named 'final-final-v-two-for-sure'!
Exactly. That's a crime.
Glad we sorted that.
BRANCH
IT! COMMIT IT!
PUSH IT!
PULL! KEEP THE HISTORY,
THAT’S THE
RULE!
(every single day!) BRANCH IT!
COMMIT IT! PUSH IT!
PULL! KEEP THE HISTORY,
THAT’S THE RULE!
Class dismissed.