Introductory Notes on the Git Source Control Management
Git is a SCM (Source Control Management System)
Torvalds and “Git”
Git: A Fast Version Control System
Bibliography
UW CS746 Seminar Course on Software Architecture
Fundamental Concepts of Source Control Management
More Fundamental Concepts of Source Control Management
Git’s Distributed Architecture: P2P
Architecture of Git Individual Repository
Architecture of Git Individual Repository
Data Structure of Repository: ERD Defines Allowed DAGs
Naming Nodes by Their Hashes
Layered Structure of Implementation of Repository
Key Git Operations
44.00K
Category: programmingprogramming

Introductory Notes on the Git Source Control Management

1. Introductory Notes on the Git Source Control Management

Ric Holt, 8 Oct 2009
1

2. Git is a SCM (Source Control Management System)

• Management of changes to documents, programs,
and other information stored as computer files.
• Its first usage have been for Linux and for Git itself.
• It is open source and free
2

3. Torvalds and “Git”

• Written by Linus Torvalds -- Mr. Linux
• What does the word “git” mean?
– Nothing?
– “A person who is deemed to be despicable or
contemptible “ ?
• From http://www.google.ca/search?hl=en&client=firefox-a&rls=org.mozilla:enUS:official&hs=Ll1&defl=en&q=define:git&ei=wi7NSofxA4rflAevsTgBQ&sa=X&oi=glossary_definition&ct=title
3

4. Git: A Fast Version Control System

• Git
– Is distributed
– Has no master copy
– Has fast merges
– Is controversial
– Scales up
– Convenient tools still being built
– Safeguards against corruption
4

5. Bibliography

• Overview of Git (1 hour video). by Randal
Schartz, 2007, Google talk, no diagrams
http://www.youtube.com/watch?v=8dhZ9BXQgc4
• Tv's cobweb: Git for Computer Scientists (nice
diagrams)
http://eagain.net/articles/git-for-computer-scientists/
• A tutorial introduction to Git (key examples
uses of commands)
o http://www.kernel.org/pub/software/scm/git/docs/
v1.2.6/tutorial.html
5

6. UW CS746 Seminar Course on Software Architecture

• Studying Git architecture (Fall 2009)
• Suggested/clarified various ideas given here
6

7. Fundamental Concepts of Source Control Management

• Source control management = SCM. Records
information about an evolving software project).
Key example: CVS.
• Project (set of files and directories, typically
comprising the source files of a software system
under development, but could be any other
“content”)
• Version (one instance of a project) (called a
commit in Git)
7

8. More Fundamental Concepts of Source Control Management

• Branch. A sequence of versions, each one
evolved from the previous one
• To branch. Split development into two parallel
branches.
• To merge. Combine two branches into single
branch
• Repository. In this case, a specialized database to
store an evolving project with its branches
8

9. Git’s Distributed Architecture: P2P

Ovals are
servers
R2
R1
R3
R4
R5
Boxes are
individual
repositories
System of distributed repositories R1, R2, ...
Mostly Git repositories, but can be CVS etc.
9

10. Architecture of Git Individual Repository

Object storage. Some times called simply a
repository. Stores representation of the versions
of project (in a directory called .git )
Git’s Index. Caches objects from work space that
have changed (added to index), and that will be
stored in the repository with the next commit
Work space. User’s sandbox (ordinary files and
directories) for active version
10

11. Architecture of Git Individual Repository

One Repository
add
Working tree
(sand box)
commit
Index
(cache)
Object
store
pull, push
More Repositories
11

12. Data Structure of Repository: ERD Defines Allowed DAGs

version commit
Each commit (version) is based on zero
or more previous versions
tree of
folders
tree
Each folder contains other folders and
files (blobs)
file
blob
Generally, committed structure is
immutable
12

13. Naming Nodes by Their Hashes

• The name (or key) of a node is the hash
(SHA1) of its contents.
• A hash can be used as a “pointer” to locate
its content
• Identical files have the same hash and are
represented by a single blob
13

14. Layered Structure of Implementation of Repository

GUI
Porcelain
(High Level
Operations)
Plumbing
(Low Level
Operations)
Operations are separate executables
(not API)
14

15. Key Git Operations

1)
Init. Create an empty Git
repository
2)
Clone. Copy a repository into a
new directory. After cloning, edit,
create and remove files for new
version
3)
Add. Add file contents from
work space to the index. (The files
are edited locally)
4)
Remove = rm. Remove files
from work space and from the
index
5)
Commit. Store the changes (that
are added) to the repository, using
the index. Completes this version.
6) Branch. Create (or delete) a
branch
7)
Merge. Join two or more
branches
8)
Rebase. Combine/restructure a
set of commits to simplify them
9) Checkout. Checkout files etc
from a commit, and switch work
space to that new branch
10)
Fetch. Download objects and
refs from another repository
11) Pull. Fetch from and merge
with another repository or a local
branch
12)
Push. Update remote refs (in
another repo) along with
associated objects
15
English     Русский Rules