git in the van highedweb 2013

64

Upload: annette-liskey

Post on 12-Jul-2015

318 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Git in the Van HighEdWeb 2013
Page 2: Git in the Van HighEdWeb 2013

Question Who uses revision control?!

#TPR7!

Page 3: Git in the Van HighEdWeb 2013

DIY Revision Control

•  Duplicate and rename

•  Track Changes / Save as Version

•  Recovering the last auto-save

Page 4: Git in the Van HighEdWeb 2013

“When you work within your confines, when you realize your limitations, that’s when you can break through them.”!

Page 5: Git in the Van HighEdWeb 2013

Revision Control Systems

•  Track changes to a set of files

•  Mostly text edits

•  Usually source code

Page 6: Git in the Van HighEdWeb 2013

Common Systems

•  Subversion (SVN)

•  BitKeeper

•  CVS, SVK, etc.

Page 7: Git in the Van HighEdWeb 2013

Compare Them All

http://en.wikipedia.org/wiki/Comparison_of_revision_control_software

Page 8: Git in the Van HighEdWeb 2013

Why Choose Git?

•  Open Source (free)

•  Distributed gives you autonomy

•  Easy branching for experimenting

Page 9: Git in the Van HighEdWeb 2013

How Git Works

#TPR7!

Page 10: Git in the Van HighEdWeb 2013

The Δ It’s Efficient

•  Revisions, not versions

•  Repo stores all changes – 1st  change:    git init!

•  Each change links to previous

Page 11: Git in the Van HighEdWeb 2013

The 3 Areas

•  Working Copy

•  Staging Index

•  Repo

Page 12: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 13: Git in the Van HighEdWeb 2013

“I was learning a lot of things fast.”!

Page 14: Git in the Van HighEdWeb 2013

An Analogy Packing a suitcase!

#TPR7!

Page 15: Git in the Van HighEdWeb 2013

Step 1: All the Things!

•  Take some shirts out of the closet

•  Throw them on the bed

Page 16: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 17: Git in the Van HighEdWeb 2013

Step 2: Just These Things

•  Choose a few shirts

•  Prepare them for packing

Page 18: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 19: Git in the Van HighEdWeb 2013

Step 3: Pack the Things

•  Put the shirts in the suitcase

Page 20: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 21: Git in the Van HighEdWeb 2013

An Example Packing pants!

Page 22: Git in the Van HighEdWeb 2013

Step 1

•  Take pants out of the closet

•  Touched the pants – that’s an edit

•  The pants are in your working copy

Page 23: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 24: Git in the Van HighEdWeb 2013

Step 2

•  Choose a few pants, fold them up

•  Selected a change – that’s an add

•  The pants are in your staging index

Page 25: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 26: Git in the Van HighEdWeb 2013

Step 3

•  Put the folded pants in your suitcase

•  Packed the pants – that’s a commit

•  The pants are in your repo

Page 27: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 28: Git in the Van HighEdWeb 2013

Another Example This time, with commands!!

Page 29: Git in the Van HighEdWeb 2013

Step 1

•  Take socks out of the drawer

•  COMMAND: (none) – Git  compares  current  files  to  repo – Changes  go  in  working  copy  

automatically

Page 30: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 31: Git in the Van HighEdWeb 2013

Step 2

•  Pick a few socks, roll them up

•  COMMAND: git add – Moves changes to staging index – Works for edited files or new files

Page 32: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

git add

Page 33: Git in the Van HighEdWeb 2013

Step 3

•  Pack the socks in your suitcase

•  COMMAND: git commit – Records the changes to your repo – Can be a single change or many

Page 34: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

git commit

Page 35: Git in the Van HighEdWeb 2013

Step 4

•  Put unused clothes away

•  COMMAND: git checkout – Erases changes from the working copy – A good way to get out of a bad situation

Page 36: Git in the Van HighEdWeb 2013

Working Copy

Working Copy

git checkout!

Page 37: Git in the Van HighEdWeb 2013

Commit #1

Commit #2

Commit #3

Page 38: Git in the Van HighEdWeb 2013

“After all the weeks of practice I felt ready to play.”!

Page 39: Git in the Van HighEdWeb 2013

A Demo With Terminal and the GitHub app!

Page 40: Git in the Van HighEdWeb 2013

State of the Repo Sequential changes!

Page 41: Git in the Van HighEdWeb 2013

Commit #1

Commit #2

Commit #3

HEAD

Page 42: Git in the Van HighEdWeb 2013

Branches Want to try something?!

Page 43: Git in the Van HighEdWeb 2013

Making Branches

git branch <name>!!

•  Clones the repo

•  New working copy and staging index

•  Git Flow – a branching model

Page 44: Git in the Van HighEdWeb 2013

Switching Branches

git checkout <name>!

•  Quickly swap to a different branch

•  Changes what’s in your editor

•  Changes what’s in the browser

Page 45: Git in the Van HighEdWeb 2013

An Example Going to Jamaica!

Page 46: Git in the Van HighEdWeb 2013

Rewind the Repo

git checkout <commit2>!!

•  Set the HEAD to commit #2

Page 47: Git in the Van HighEdWeb 2013

Commit #1

Commit #2

Commit #3

HEAD

Page 48: Git in the Van HighEdWeb 2013

Commit #1

Commit #2

Commit #3

HEAD

Page 49: Git in the Van HighEdWeb 2013

Branch the Rewind

git checkout – b <branchName>! •  Make a new branch off that commit

Page 50: Git in the Van HighEdWeb 2013

Master Jamaica

Page 51: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 52: Git in the Van HighEdWeb 2013

Get a Passport

•  A new item, not yet tracked

•  COMMAND: git add – Skip the working copy – Add directly to staging index

!

Page 53: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

git add

Page 54: Git in the Van HighEdWeb 2013

Pack the Passport

•  Pack the passport

•  COMMAND: git commit – Add to the repo

Page 55: Git in the Van HighEdWeb 2013

Working Copy

Staging Index

Repo

Page 56: Git in the Van HighEdWeb 2013

Merge the Changes

•  Add the change to the master branch

•  COMMAND: git merge – Merge all changes or cherry pick

Page 57: Git in the Van HighEdWeb 2013

Master Jamaica

Page 58: Git in the Van HighEdWeb 2013

Master Jamaica

Page 59: Git in the Van HighEdWeb 2013

Demo Time Checkout prior commit, branch, merge

Page 60: Git in the Van HighEdWeb 2013

GitHub.com “Just do it like it’s all you knew how to do.”!

Page 61: Git in the Van HighEdWeb 2013

Learn More

•  http://try.github.io

•  “Git Essential Training” by Kevin Skoglund on Lynda.com

•  http://git-scm.com/book

Page 62: Git in the Van HighEdWeb 2013

Clone This Rep

!https://github.com/brufftech/git-suitcase.git

Page 63: Git in the Van HighEdWeb 2013

Credits

•  Quotes from Get in the Van by Henry Rollins

•  Designer:  Jacob  Melton    [email protected]

•  Presenter:  Annette  Liskey    [email protected]

Page 64: Git in the Van HighEdWeb 2013

Questions?