The document provides an introduction to GIT and compares it to SVN. It discusses the advantages of GIT such as faster performance, local repositories, and easier branching. The document outlines GIT's basic components like the working directory, staging area, and repository. It also summarizes common GIT commands for managing branches, merging, and pushing/pulling changes.
2. Objective
• Understand the advantage of GIT and determine if we should use GIT or not.
Know how to use the common used GIT commands
12/12/201 2
3. Subject
Characteristic of GIT
– The most powerful features of GIT
– Explain the differences between GIT and SVN
• GIT basic usages
- Day to day GIT used commands
• Resources
12/12/2012 3
5. History
Invented by Linus Torvalds to support the development of the Linux Kernel
Incredibly fast, very efficient with large projects, has an incredible branching system
for non-linear development
• Projects using Git : Linux Kernel, Perl, Eclipse, Android ...
12/12/2012 5
6. Compare to SVN
There are many version control tools in the market But GIT is a completely difference
tool GIT own many distinct, powerful features
• Interface is fairly similar to SVN
• Git stores and thinks about data differently than SVN
12/12/2012 6
7. Compare to SVN(cont..)
SVN Data Model:
GIT Data Model:
SVN store history as a list of file-based
Database addressable by the hash value of its
changes
contents
12/12/2012 7
8. Compare to SVN(cont..)
Repository
GIT - Local and multi Remote Repositories
SVN – only 1 repository on server
• SVN may loose history in some case, Git doesn't
12/12/2012 8
9. Compare to SVN(cont..)
5 Fundamental differences between GIT & SVN
1. GIT is distributed, SVN is not
2. GIT stores content as metadata, SVN stores just files
3. GIT branches are much more easier & fun is not the same as SVN branches.
4. GIT does not have a global revision no. like SVN do
5. GIT’s content integrity (using SHA-1 hash algorithm) is better than SVN’s.
12/12/2012 9
10. Why's GIT fast ?
• The internal database structure
Nearly every operation is Local. Entire history is on local disk
This database is compressed effectively transfer over network, use SSH or GIT
protocol
12/12/2012 10
11. State
• States : untracked, modified, and staged, committed
File Status Lifestyle
Untracked Unmodified Modified Staged
Edit the File
Add the File
Stage the File
Remove the File
Commit
12/12/2012 11
12. Working Area
• The Git directory, the working directory, and the staging area.
Local Operation
Working Git Directory
Staging Area
Directory (repository)
Checkout the Project
Stage Files
Commit
12/12/2012 12
13. Branch Management
Killer feature – Managing branches. Make Git apart in the VCS community
Branching operations nearly instantaneous. Switching back and forth between
branches just as fast
We can create branches, and merge often even multiple times in a day
12/12/2012 13
14. Switch Branch
Point to Current Branch HEAD
master
98ca9 34ac2 f30ab
master
testing
98ca9 34ac2 f30ab
testing
Switch Branch HEAD
12/12/2012 14
16. FastForward Push
GIT “push” comand equals to svn commit. By default, GIT only allow “FastForward”
push. To override this, use --force option
C3
before push
C0 C1 C2 C4
master
public repository's master
after force push
12/12/2012 16
40. Installing GIT
• Address: http://git-scm.com/download
• Window, Mac – Download Installation file
Linux - The primary Git package :
git-core, git-doc – document
git-cvs, git-svn – work with CVS, or SVN
gitk – graphical application
• $ sudo apt-get install git-core git-doc gitk git-svn
12/12/2012 40
41. Resources
More explanation why use GIT
http://whygitisbetterthanx.com
Basic tutorial
Version Control with Git - O'Reilly Media “Advance GIT”
12/12/2012 41