git in the van highedweb 2013

Post on 12-Jul-2015

318 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Question Who uses revision control?!

#TPR7!

DIY Revision Control

•  Duplicate and rename

•  Track Changes / Save as Version

•  Recovering the last auto-save

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

Revision Control Systems

•  Track changes to a set of files

•  Mostly text edits

•  Usually source code

Common Systems

•  Subversion (SVN)

•  BitKeeper

•  CVS, SVK, etc.

Compare Them All

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

Why Choose Git?

•  Open Source (free)

•  Distributed gives you autonomy

•  Easy branching for experimenting

How Git Works

#TPR7!

The Δ It’s Efficient

•  Revisions, not versions

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

•  Each change links to previous

The 3 Areas

•  Working Copy

•  Staging Index

•  Repo

Working Copy

Staging Index

Repo

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

An Analogy Packing a suitcase!

#TPR7!

Step 1: All the Things!

•  Take some shirts out of the closet

•  Throw them on the bed

Working Copy

Staging Index

Repo

Step 2: Just These Things

•  Choose a few shirts

•  Prepare them for packing

Working Copy

Staging Index

Repo

Step 3: Pack the Things

•  Put the shirts in the suitcase

Working Copy

Staging Index

Repo

An Example Packing pants!

Step 1

•  Take pants out of the closet

•  Touched the pants – that’s an edit

•  The pants are in your working copy

Working Copy

Staging Index

Repo

Step 2

•  Choose a few pants, fold them up

•  Selected a change – that’s an add

•  The pants are in your staging index

Working Copy

Staging Index

Repo

Step 3

•  Put the folded pants in your suitcase

•  Packed the pants – that’s a commit

•  The pants are in your repo

Working Copy

Staging Index

Repo

Another Example This time, with commands!!

Step 1

•  Take socks out of the drawer

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

automatically

Working Copy

Staging Index

Repo

Step 2

•  Pick a few socks, roll them up

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

Working Copy

Staging Index

Repo

git add

Step 3

•  Pack the socks in your suitcase

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

Working Copy

Staging Index

Repo

git commit

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

Working Copy

Working Copy

git checkout!

Commit #1

Commit #2

Commit #3

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

A Demo With Terminal and the GitHub app!

State of the Repo Sequential changes!

Commit #1

Commit #2

Commit #3

HEAD

Branches Want to try something?!

Making Branches

git branch <name>!!

•  Clones the repo

•  New working copy and staging index

•  Git Flow – a branching model

Switching Branches

git checkout <name>!

•  Quickly swap to a different branch

•  Changes what’s in your editor

•  Changes what’s in the browser

An Example Going to Jamaica!

Rewind the Repo

git checkout <commit2>!!

•  Set the HEAD to commit #2

Commit #1

Commit #2

Commit #3

HEAD

Commit #1

Commit #2

Commit #3

HEAD

Branch the Rewind

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

Master Jamaica

Working Copy

Staging Index

Repo

Get a Passport

•  A new item, not yet tracked

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

!

Working Copy

Staging Index

Repo

git add

Pack the Passport

•  Pack the passport

•  COMMAND: git commit – Add to the repo

Working Copy

Staging Index

Repo

Merge the Changes

•  Add the change to the master branch

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

Master Jamaica

Master Jamaica

Demo Time Checkout prior commit, branch, merge

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

Learn More

•  http://try.github.io

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

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

Clone This Rep

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

Credits

•  Quotes from Get in the Van by Henry Rollins

•  Designer:  Jacob  Melton    meltonjd@dukes.jmu.edu

•  Presenter:  Annette  Liskey    liskeyab@jmu.edu

Questions?

top related