SlideShare a Scribd company logo
Getting
Git
Webuquerque,
April
2011
Who
am
I?
Brian
Arnold
(Upper
left)

Software
Engineer

for
SitePen,
Inc.

JavaScript
fanatic

Technology

evangelist
Who
are
you?
A
developer/designer
who's
lost
work

before
A
freelancer
who
needs
to
manage
a

wide
variety
of
projects
Someone
to
heckle
me,
asking
me
if
I

used
jQuery
to
make
this

presentation
Version
Control!
  What
is
it?
Why
do
I
care?
Version
Control
Proper
definition:
Version
control
is
a
means
of

managing
a
set
of
files,
typically

code
or
markup
of
some
sort,
managed

as
repositories
of
code
Varieties
of
version
control

systems:
  Ad‐hoc,
Centralized,
Distributed
  A
wide
variety
of
choices
Ad‐hoc
         This
works...

         sort
of

         Easy
to
lose

         work

         Hard
to

         manage
Centralized
VCS
Requires
a
central
server
(and

therefore
typically
network
access

to
said
server)
Clients
(that'd
be
you)
typically

get
a
copy
of
the
latest
version
of

the
repository's
contents
Depending
on
implementation,
files

may
be
checked
out
or
locked
while

working
on
them
Centralized
VCS

CVS
(1990)
Microsoft
Visual
SourceSafe
(1994)
Subversion
(2000)
Distributed
VCS
Client
typically
makes
a
copy
of
the

entire
repository
to
their
system
Most
actions
are
local
to
your

system,
not
network‐based
Possible
to
have
a
centralized

shared
repository
to
facilitate

multi‐user
work
Distributed
VCS

Git
(2005)
Mercurial
(2005)
Bazaar
(2007)
Choose
Wisely!
Centralized
systems
can
be
simpler

to
manage
Distributed
much
easier
to
use
on

smaller
scale
Think
about
your
needs
‐
don't
just

bash
something
because
it's
not
cool
So
then...
Why
am
I
talking
about
Git?
A
Solid
Choice

Git
is
a
distributed
version
control

system
(DVCS)
Immensely
popular,
used
to
manage
a

ton
of
popular
open
source
projects
Fantastic
educational
materials
What's
special?
Stores
snapshots
of
files
(NOT
differences)
Nearly
every
operation
is
local
(no
server
needed!)
Written
to
be
strong
against

corruption
of
data
while
being

highly
performant
Fscking
Git,
how

 does
it
work??
Git
is
somewhat
like
a
self‐
contained
file
system,
with
three

distinct
areas:
  Working
directory
  Staging
area
  Repository
Working
Directory

 Your
main
working
area
for
files
 Just
a
directory
 Has
the
most
recent
version
of
the

 code
Staging
Area
Internal
to
Git
Has
copies
of
files
that
are
being

set
up
to
be
pushed
into
the

repository
Files
can
be
added
and
removed

before
being
committed
into
the

repository
Repository
The
.git
directory
All
of
Git's
metadata,
objects,
and

database
are
stored
in
here,
after

they've
been
staged
and
committed
Here
there
be
Dragons
(don't
alter

files
in
this
directory
directly)
Often
referred
to
as
a
Repo
Getting
Git!
       By
which
I
mean,
installing
it
in
some
fashion,
      not
comprehension,
         that's
later
http://bit.ly/SetUpGit
Will send you to help.github.com for your OS
Global
Config
The
dollar
sign
in
their
instructions

represents
the
prompt
‐
don't
actually

type
it
out

The
steps
walk
you
through
setting
up

some
configuration
that
is
GitHub‐
specific

The
global
config
is
not
GitHub‐specific

Do
set
your
user.name
and
user.email

configuration
pieces
before
you
start
up

a
repository,
as
per
instruction
Global
Config
Getting
Git!
Okay,
now
we're
talking
comprehension
Goals
How
to
start
using
Git
as
an

individual
Comfort
with
creating
your
own
repo
(Hopefully
some)
comfort
with

branching
and
merging
Feeling
excited
for
Git!
git
init
Setting
up
your
repo
Starting
Point
Starting
Point
git
init
git
init
git
init

That's
it
No,
really,
that's
it
You
now
have
a
Git
repository!
git
status
Checking
in
on
your
repo
git
status
A
useful
command
to
check
the
status

of
your
current
workspace,
as
well

as
staging
area
Gives
you
useful
information
as
to

actions
you
can
take
We'll
be
using
this
command
often

throughout
the
presentation
git
status
git
add
Setting
the
stage
for
your
repo
git
add
Add
files
to
the
Staging
Area
(prep

for
being
put
in
the
repository)
Marks
files
to
be
tracked
by
Git

when
they
are
staged
for
the
first

time
Will
work
recursively
through

directories
Often
people
run
`git
add
.`
to
set

up
all
files
git
add
HOLD
UP!
What
if
I
don't
want
all
the
files?
.gitignore

A
special
file
to
Git
Put
at
the
root
of
your
working

directory
List
files
and
patterns
you
want
to

ignore
.gitconfig
.gitconfig
.gitconfig
.gitconfig
.gitconfig
git
diff
 What
changed?
git
diff

Shows
you
changes
in
your
files
that

have
not
been
staged
If
a
change
is
staged,
it
won't
show

up
in
a
git
diff
unless
you
use
the

‐‐cached
option
after
the
command
git
diff
git
commit
Actually
putting
files
  into
the
repository
git
commit

Moves
files
from
the
Staging
Area

into
the
Repository
Accepts
a
Commit
Message
  Messages
are
important!
  Succinctly
describe
the
changes

  you're
committing
git
commit
Use
the
‐m
command
to
add
a
message:

git
commit
‐m
"My
message"


You
can
skip
adding,
and
just
commit

all
tracked
files
with
‐a:

git
commit
‐am
"Several
changes"
Message
about

   messages
Please,
please
write
good
commit

messages
Important
for
looking
back
in
the

history
of
your
repository
Makes
it
easy
for
the
moron
who's

stuck
maintaining
your
work
later
(You're
often
that
moron,
so
be
nice

to
yourself)
git
commit
WOO!
WE
HAVE
CODE
SAFELY
STORED!
...
So...
now
what?
Keep
doing
it!
The
most
basic
and
standard
Git

workflow
  Work
on
your
files
  Choose
which
ones
to
commit
with

  git
add
  Properly
put
them
in
the
repo
with

  git
commit
Time
passes
Like
sands
through
the
hourglass
git
log
Looking
back
git
log

A
simple,
straight‐forward
command

with
a
lot
of
power
to
review
what

you've
done
with
Git
Takes
a
few
options
to
display

information
in
a
variety
of
ways
git
log
EXCITING!
      Well,
okay,
not.

Let's
look
at
a
real
example.
git
log
git
log

Some
parameters
that
can
be
used:
  ‐p
:
shows
the
difference
  ‐#
:
limits
results
to
last
#
logs
  ‐‐pretty
:
Can
change
format
of

  output
  ‐‐graph
:
Can
draw
branch
graphs
git
log
‐p
git
log
‐2
git
log
‐‐pretty=oneline
git
log
‐‐pretty=oneline
‐‐graph
git
log

There
are
tons
of
ways
to
look
at

your
data
This
command
is
part
of
why
good

commit
messages
are
important
With
poor
messages,
your
log
can

wind
up
worthless
Branching!
But
first,
some
details
about
Git
that

 we'll
need
to
understand
branching.

      Would
this
be
a
branch...
       about
branches?
#rimshot

       I'll
be
here
all
night!
What
is
a
commit?
 A
container
of

 metadata            Commit

 Has
a
pointer
to

 the
directory

 snapshot

 Has
zero
or
more

 pointers
to

 parent
commits      Snapshot
What
is
a
commit?
                    C1

 Each
time
you

 commit,
the
new

 commit
records

 which
one
came

 before
it
What
is
a
commit?
                    C1        C2

 Each
time
you

 commit,
the
new

 commit
records

 which
one
came

 before
it
                         C3
What
is
a
branch?
                      master
 A
branch
is

 nothing
more
than

 a
pointer
to
a

 commit

 In
fact,
you

 always
have
one

                        C3
 branch
at
first:
 master
Callback!
Another

visualization




Courtesy of progit.org
git
branch
Managing
your
branches
git
branch


With
no
additional
options,
it
will

list
all
of
your
branches,
starring

the
one
you're
currently
on
git
branch
git
branch
git
branch


When
provided
with
a
word
after
the

command,
it
creates
a
branch
with

that
name
git
branch
testing
git
branch
testing
git
branch

So,
how
does
Git
know
what
branch

you're
on?
Git
maintains
another
pointer,

called
"HEAD",
which
points
at
the

branch
you're
on
This
makes
more
sense
with
a

graphic,
so
let's
see
one
git
branch
testing
git
checkout
How
to
move
from
branch
to
branch
git
checkout

To
move
from
one
branch
to
another,

simply
run
`git
checkout
branchname`

where
branchname
is
the
branch
you

want
to
move
to
If
you
want
to
create
a
branch
at

the
time
of
checkout,
run
it
with

the
‐b
option:
git
checkout
‐b
newbranch
git
checkout
testing
git
checkout
testing
git
checkout

Once
you've
switched
to
another

branch,
you
can
start
working
like

you
normally
had
been
Use
`git
add`
and
`git
commit`
like

before
Work
like
normal
What's
happening?
Moving
around

You
can
work
on
multiple
branches
in

tandem
Don't
be
afraid
to
branch
‐
as

they're
just
pointers,
the
overhead

for
using
branches
is
very
low
Moving
around
Moving
around
git
merge
Getting
the
code
back
together
Starting
point
Starting
point
URGENT!!!
Your
Repo's
State
git
merge

When
given
the
name
of
a
branch,
it

does
its
best
to
intelligently
sync

up
file
changes
If
possible,
it
simply
moves

pointers
forward
git
merge
git
merge
git
merge

If
it
can't
just
fast
forward,
git

will
create
a
new
commit
that
points

back
at
the
merge
bases
Git
will
do
its
best
to

intelligently
merge
the
two
commits,

and
it
generally
does
the
right

thing
Sometimes,
though,
we
don't
Making
conflict
git
merge
git
merge
git
merge

In
order
to
fix
a
conflict,
open

your
file
and
look
for
the
<<<<<<

line
It
will
show
you
what
conflicted
‐

clean
up,
save,
and
git
add
the
file

to
mark
the
conflict
as
resolved
git
merge
git
merge
git
merge
git
merge
Looking
back
Homework
Because
we
all
love
homework!
Homework

Go
install
Git
on
your
system:
http://bit.ly/SetUpGit
Set
up
a
GitHub
account
while
you're

there
Go
read
http://progit.org/book/
Try
Git
out
on
your
next
project!
Questions!
Like
we
have
time
for
questions.
       This
is
slide
110!
Thank
you!
Talk
to
me:
brianarn@gmail.com
@brianarn
on
Twitter/GitHub
Rate
me:
http://spkr8.com/t/7087
View
this
presentation's
repo:
https://github.com/brianarn/
GettingGit

More Related Content

PDF
Git best practices workshop
PDF
Git Tutorial 教學
PPTX
Git Lab Introduction
PDF
Git and git flow
PPTX
Git 101 for Beginners
PPTX
Grokking opensource with github
PDF
View customize1.2.0の紹介
PPTX
Git - Basic Crash Course
Git best practices workshop
Git Tutorial 教學
Git Lab Introduction
Git and git flow
Git 101 for Beginners
Grokking opensource with github
View customize1.2.0の紹介
Git - Basic Crash Course

What's hot (20)

PPTX
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
PDF
Git & GitHub WorkShop
PDF
Starting with Git & GitHub
PPTX
GitHub Basics - Derek Bable
PPTX
Bitbucket
PPTX
工程師必備第一工具 - Git
PDF
Introduction to Git and GitHub
PDF
Introduction to Git and Github
PPTX
Introduction to Gitlab | Gitlab 101 | Training Session
PPTX
Git One Day Training Notes
PPTX
Git & GitLab
PDF
Concurrency With Go
PDF
Git advanced
PPTX
Rust Intro
PPTX
Github basics
PDF
Git and github 101
PPTX
Git Branching and Merging.pptx
PPTX
Git Branch
PPTX
A successful Git branching model
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git & GitHub WorkShop
Starting with Git & GitHub
GitHub Basics - Derek Bable
Bitbucket
工程師必備第一工具 - Git
Introduction to Git and GitHub
Introduction to Git and Github
Introduction to Gitlab | Gitlab 101 | Training Session
Git One Day Training Notes
Git & GitLab
Concurrency With Go
Git advanced
Rust Intro
Github basics
Git and github 101
Git Branching and Merging.pptx
Git Branch
A successful Git branching model
Ad

Viewers also liked (8)

PDF
Getting Into Git
PDF
Getting Started on distributed version control with git
PDF
Getting Into Git
PDF
Getting started with GitHub
PDF
Git workshop
PDF
Git: A Getting Started Presentation
PDF
Introduction to git
PDF
Quick Introduction to git
Getting Into Git
Getting Started on distributed version control with git
Getting Into Git
Getting started with GitHub
Git workshop
Git: A Getting Started Presentation
Introduction to git
Quick Introduction to git
Ad

Similar to Getting Git (20)

PDF
Subversion to Git Migration
PDF
Git_tutorial.pdf
PDF
Git for developers
PPTX
PPTX
Git 101 - An introduction to Version Control using Git
PPTX
Git essential training & sharing self
PDF
Bsadd training-git
PPTX
BSADD-Git-TRAINING
PPTX
Git usage (Basics and workflow)
PDF
Gitting better
PPTX
Introduction to GitHub, Open Source and Tech Article
PPT
PPT
PPT
PPT
PPTX
Git session 1
ODP
Git 101, or, how to sanely manage your Koha customizations
PPTX
Mini-training: Let’s Git It!
PPT
git.ppt
PPTX
Git for a newbie
Subversion to Git Migration
Git_tutorial.pdf
Git for developers
Git 101 - An introduction to Version Control using Git
Git essential training & sharing self
Bsadd training-git
BSADD-Git-TRAINING
Git usage (Basics and workflow)
Gitting better
Introduction to GitHub, Open Source and Tech Article
Git session 1
Git 101, or, how to sanely manage your Koha customizations
Mini-training: Let’s Git It!
git.ppt
Git for a newbie

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation theory and applications.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Unlocking AI with Model Context Protocol (MCP)
Encapsulation theory and applications.pdf
Network Security Unit 5.pdf for BCA BBA.
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”

Getting Git

Editor's Notes