GIT Esc Chicago 2010
GIT Esc Chicago 2010
GIT Esc Chicago 2010
Community Software
Jerry Cooperstein
June 2010
Distributed Development
GIT and Revision Control Systems
GIT Design Features
GIT Concepts
Repositories
Main Operations
Main Commands
Using GIT: an Example
File Management
Making Commitments
Cloning
Branches
Merging
Rebasing
Bisection
Dealing with Patches
Further Training
Distributed Development
Many developers, working separately
No structural authoritative central repository
Every repository is as authoritative is any other
Peer-to-peer in nature
The influence of the main project maintainer is social
and political, not technical
No preferred model for organization
CVS/Subversion:
Bitkeeper
Central repository
Multiple users, network capabilities
Simultaneous commits
GIT Concepts
Repositories
Configuration information such as names, email of
authors, which is not carried forth by clone operation
All repositories are equal
The repository is a database containing information to:
Manage revisions
Display history
Store a project
Main Operations
Creating or Cloning
Checkout
Adding
Committing
Tagging
Diffing
Showing history
Pulling and Pushing
Patching
Bisection
Branching
Merging
Rebasing
Main Commands
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [-bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]
The most commonly used git commands are:
add
Add file contents to the index
bisect
Find the change that introduced a bug by binary search
branch
List, create, or delete branches
checkout
Checkout a branch or paths to the working tree
clone
Clone a repository into a new directory
commit
Record changes to the repository
diff
Show changes between commits, commit and working tree, etc
fetch
Download objects and refs from another repository
grep
Print lines matching a pattern
init
Create an empty git repository or reinitialize an existing one
log
Show commit logs
merge
Join two or more development histories together
mv
Move or rename a file, a directory, or a symlink
pull
Fetch from and merge with another repository or a local branch
push
Update remote refs along with associated objects
rebase
Forward-port local commits to the updated upstream head
reset
Reset current HEAD to the specified state
rm
Remove files from the working tree and from the index
show
Show various types of objects
status
Show the working tree status
tag
Create, list, delete or verify a tag object signed with GPG
An Example: I
$ mkdir git-test
$ cd git-test
$ git init
$ ls -l .git
total 40
drwxrwxr-x 7
drwxrwxr-x 3
drwxrwxr-x 2
-rw-rw-r-- 1
-rw-rw-r-- 1
-rw-rw-r-- 1
drwxrwxr-x 2
drwxrwxr-x 2
drwxrwxr-x 4
drwxrwxr-x 4
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
coop
4096
4096
4096
92
58
23
4096
4096
4096
4096
Dec
Dec
Dec
Dec
Dec
Dec
Dec
Dec
Dec
Dec
30
30
30
30
30
30
30
30
30
30
13:59
13:59
13:59
13:59
13:59
13:59
13:59
13:59
13:59
13:59
./
../
branches/
config
description
HEAD
hooks/
info/
objects/
refs/
An Example: II
git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: somejunkfile
Make a modification
An Example: III
Showing history
$ git log
commit eafad66304ebbcd6acfe69843d246de3d8f6b9cc
Author: A Genius <[email protected]>
Date:
Wed Dec 30 11:07:19 2009 -0600
My initial commit
File Management
File Categories:
Tracked:
in repository
Ignored:
mentioned in .gitignore file
Untracked: not added yet, temporary, etc
$
$
$
$
$
git
git
git
git
git
add myfile
rm myfile
rm myfile cached
mv oldfile newfile
ls-files
Making Commitments I
Making Commitments II
.............
$ git log --pretty=oneline
4b4bf2c5aa95b6746f56f9dfce0e4ec6bddad407 This is the fourth commit
55eceacc9ab2b4fc1c806b26e79eca4429d8b52a This is the third commit
f60c0c21764676beca75b7edc2f5f5e51b5dd404 This is the second commit
712cbafa7ee0aaef03861b049ddc7865220b4e2c This is the first commit
Cloning
Branches I
Branches II
Merging
Rebasing
Bisection
Be careful with format, plain ascii text, no linewrapping, etc. when emailing
Further Training
5-day class
Lab-based with real devices
http://training.linuxfoundation.org