It Belongs in a Museum – The tenants of Git usage – Your code is precious



It Belongs in a Museum – The tenants of Git usage – Your code is precious

0 1


git-different

My talk on the three git tenets. With extra Indiana Jones.

On Github CSilivestru / git-different

It Belongs in a Museum

Three Git tenants, updated

Presented by Chris Silivestruwww.bithound.io / @bithoundio

Chris Silivestru

Lead Developer / Code Poet

bitHound

@chriscoit

The tenants of Git usage

I've heard these three basic rules:
  • Write what you did
  • Don't rebase
  • Commit very often

Shiny rules but...

Real quick, though!

What is Git again?

Your code is precious

Changing it is a big deal!
Old: Write what you did
New: Write why you did it

We're smart people

Why tell me what the diffs tell me?

When in doubt!

Ask youself why you're doing this

Got it! Let's see it in action.

Your code is a journey

And the git log in the novel
Old: Don't rebase
New: Definitely rebase

The way we'll use it

Superfluiousness....ness

Rebase is your friend

Rewrite history

But wait! There's more

Rebase makes merge commits useful
Usefulness....ness

It's easier than you think

git merge master my-feature-branch //stop doing this

becomes....

git checkout my-feature-branch //Go to your branch
git rebase -i master //rebase it on top of master (or other branch)

*Note: the '-i' is optional

Cool! Let's see it working

Too much of anything can be bad

Lots of commits mean some are filler
Old: Commit early and often
New: Commit early and often*

*Just don't leave it that way

Commit = Change

A change should be atomic, not 'small'

You know how to do this now

Alrighty! One more demo

Ok, so what?

Having the right approach pays off

Thanks so much!

@chriscoit

Slides: CSilivestru/git-different

Coffee Repo: CSilivestru/coffee

Go and check us out!!

www.bithound.io