git in 5 minutes

29
in 5 minutes r2d.to/gitstart

Upload: robert-dumas

Post on 18-Jul-2015

1.006 views

Category:

Technology


3 download

TRANSCRIPT

in 5 minutes

r2d.to/gitstart

BACKUPS AREREALLY F**KINGIMPORTANT

photo credit: alexander muse (flic.kr/p/noL2K)

snapshots

snapshots

✓ what files have changed

✓ who made those changes

✓ when the changes were made

✓ how those changed files differ

✓ why they were changed (hopefully)

version control

wikipediarecord of changes

to articles over time

✓ free & open source✓ local & distributed✓ fast & secure✓ stable & popular

what’s so great about git?

getting gitinstalling itbaked right in

textmatebundle

xcode

and more!

eclipseplugin

use homebrew mxcl.github.com/homebrew

use apt-get or yum

download itgit-scm.com/downloads

✓ free & open source

✓ local & distributed

✓ fast & secure

✓ stable & popular

what’s so great about git?

basic workflowcreate/clone repository

make changes

commit changes

stage changes

1

2

3

4

photo credit: muy yum (flic.kr/p/7ByV6Y)

stage

work area

git

git basics

creating a repository

$  cd  myproject$  git  init

myproject/.git/

don’t touch these files!

cloning a repository$  git  clone  https://github.com/progit/progit.git

folder or URL

the location can be a folder or url

staging changes$  git  add  myfile.html$  git  add  css/*

you have to stage your changes each time you commit!

committing changes$  git  commit  -­‐m  "Added  new  file,  myfile.html,  to  repo."

other commands$  git  log$  git  diff  a65fe40$  git  rm$  git  mv commit hash

.gitignoresource/**.tempnuclear-­‐launch-­‐codes.txt

put files, folders and patterns in this file to tell git to ignore them.

branching & mergingmaster

development

feature

branching

$  git  branch  child$  git  checkout  child

1. create child branch2. check out child branch3. work on new branch

merging

$  git  checkout  parent$  git  merge  child

1. check out parent branch

2. merge child branch into parent

the ‘stache

the ‘stache

the stash$  git  stash$  git  stash  apply$  git  stash  list$  git  stash  drop        STASH_ID

tagging

$  git  tag  -­‐a  v1.0  -­‐m  "Product  release"

$  git  tag  -­‐a  ronburgundy  -­‐m  "Brick  killed  a  guy  with  a  trident."

master

development

v1.0

distributed gitshared

repositorydeveloper

developer

developer

$  git  pull  origin  master$  git  push  origin  master

rob dumaschicago public library@stray

thank you, code4lib!r2d.to/gitstart