150 likes | 210 Views
Introductory Notes on the Git Source Control Management. Ric Holt, 8 Oct 2009. 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.
E N D
Introductory Notes on the Git Source Control Management Ric Holt, 8 Oct 2009
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
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:en-US:official&hs=Ll1&defl=en&q=define:git&ei=wi7NSofxA4rflAevs-TgBQ&sa=X&oi=glossary_definition&ct=title
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
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) • http://www.kernel.org/pub/software/scm/git/docs/v1.2.6/tutorial.html
UW CS746 Seminar Course on Software Architecture • Studying Git architecture (Fall 2009) • Suggested/clarified various ideas given here
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)
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
Git’s Distributed Architecture: P2P Ovals are servers R2 R1 R3 Boxes are individual repositories R4 R5 System of distributed repositories R1, R2, ... Mostly Git repositories, but can be CVS etc.
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
Architecture of Git Individual Repository One Repository add commit Working tree (sand box) Index (cache) Object store pull, push More Repositories
Data Structure of Repository: ERD Defines Allowed DAGs Each commit (version) is based on zero or more previous versions commit version tree Each folder contains other folders and files (blobs) tree of folders blob file Generally, committed structure is immutable
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
Layered Structure of Implementation of Repository GUI Porcelain (High Level Operations) Plumbing (Low Level Operations) Operations are separate executables (not API)
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 Key Git Operations