harvard abcd-www git presentation

17
GIT, VERSION CONTROL, AND YOU. An introduction to the tastiest version control system. Ever. Courtesy of Jeff Byrnes [email protected]

Upload: jeff-byrnes

Post on 13-Jul-2015

1.283 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Harvard ABCD-WWW Git presentation

GIT, VERSION CONTROL,AND YOU.

An introduction to the tastiest version control system.Ever.

Courtesy of Jeff [email protected]

Page 2: Harvard ABCD-WWW Git presentation

WHATCHU TALKIN’ ‘BOUT?• Who is this guy?

• What is Git?

• More importantly, what’s source control?

• Why do I need it?

• What makes Git so uber-sweet? And no so sweet?

• Get the party started

• Command me, o Git

• Back to the Future

• Branch me, baby

• Embracing conflict

• More resources

Page 3: Harvard ABCD-WWW Git presentation

WHO IS THIS GUY?

• Jeff Byrnes

• Web Developer (self-taught; HTML/CSS/PHP/JS)

• Trained Musician (upright & electric bass)

• Learned Git in just a few months, and now I’m here to share!

Page 4: Harvard ABCD-WWW Git presentation

WHAT IS GIT?

• A distributed version control system

• Created by Linus Torvalds, the guy behind Linux

• Used by lots of people, big to small (think Google, Twitter, etc.)

• Especially popular amongst open-source projects

• GitHub, anyone? jQuery, Linux, etc.

Page 5: Harvard ABCD-WWW Git presentation

SOURCE CONTROL?

• Ever heard of this website?

Page 6: Harvard ABCD-WWW Git presentation

SOURCE CONTROL?

• Source control is like a wiki for your text

• Lots of different systems (here’s three):

• CVS

• Subversion

• Mercurial

Sorry, there isn’t a logo for CVS. It was made way back when logos weren’t cool.

Page 7: Harvard ABCD-WWW Git presentation

SOURCE CONTROL?

• Older systems (CVS, Subversion) are centralized

• Network access is required

• Everyone is dependent on the server

Server

Committer Committer

Page 8: Harvard ABCD-WWW Git presentation

SOURCE CONTROL?

• Git (and a few others) are distributed

• This means every copy of the repository is a clone

• So you can run off on your own & go nuts, or even push/pull to each other

Server

Clone Clone

Page 9: Harvard ABCD-WWW Git presentation

SOURCE CONTROL?

• Well great, Jeff, but what if I’m a one-person operation?

• It’s also fast. Like whoa fast.

• It also tracks changes on a line-by-line basis, instead of on a file-by-file basis

Give some examples of how line-by-line rocks the hizzouse

Page 10: Harvard ABCD-WWW Git presentation

THE SWEET

• A history of your changes

• Line-by-line changes

• Cheap branching

• No server needed

Page 11: Harvard ABCD-WWW Git presentation

THE NO-SO-SWEET

• Not great for binary files (images, movies, etc.)

• Lots to learn

• Still very much a programmer’s tool

Page 12: Harvard ABCD-WWW Git presentation

GET THE PARTY STARTED

• Install & identify yourself

• Mac & Linux users: rejoice

• Windows users: I’m sorry

•git init

• That’s it.

Be sure to go over git config --global for username & email

Page 13: Harvard ABCD-WWW Git presentation

AT YOUR COMMAND

•git add

•git commit

•git branch

•git merge

•git push / git pull

Page 14: Harvard ABCD-WWW Git presentation

BACK TO THE FUTURE(THINK, MCFLY, THINK!)

• Lots of commands to undo

• Here’s the two basic ones:

•git revert

•git reset

Page 15: Harvard ABCD-WWW Git presentation

BRANCH ME

• A branch is a separate strand of work

• Think features, bug fixes, flights of fancy

•git checkout -b branchname

Branches are cheap, and should be used wildly. Explain how checking out a branch changes the whole working tree.

Page 16: Harvard ABCD-WWW Git presentation

EMBRACE CONFLICT(MERGES AREN’T SCARY)

• Git is conservative

• Git always defers to your judgment

• Throws a merge conflict if it even thinks something is awry

• GUI tools (e.g., Tower, Sourcetree, TortoiseGit) make merges way easier

Page 17: Harvard ABCD-WWW Git presentation

MORE RESOURCES

• Git - git-scm.com

• Git Book - book.git-scm.com

• Successful branching model - nvie.com/posts/a-successful-git-branching-model/

• Git Ready - gitready.com

• Get Started w/ Git - alistapart.com/articles/get-started-with-git/

• Git Reference - gitref.org

• Think Like A Git - think-like-a-git.net

• Interactive Git Cheatsheet - ndpsoftware.com/git-cheatsheet.html