Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

@chickamade $ whatis git

the stupid content tracker ...

git init

For the first 10 years of kernel maintenance, we literally used tarballs and patches, which is a much superior source control management system than CVS is.

There is no way to do CVS right.

Linus Torvalds

"Should I hacked together a stupid content tracker during my weekend so I can stop using this CVS/SVN shit?!?"
or so thought Linus, and over a few months ...

git was created, its design criteria:

cache-concious design

all repository are created equal !!!

unless one is promoted to be the origin of all things (just like svn)

github: you may fork, but you must request to be pulled

dictator: be careful of who you trust when merging!

authentication of history
git engineering

commits are snapshots, not deltas

each commit points to its parent (knows its own history)

merge is a commit with N parents, retaining merge history

tags & branches are simply pointers to commits

getting started

# git let you choose your display name
$ git config --global "Your Name"
$ git config --global you@yourdomain

# to start new repo
$ git init

# to clone an existing one
$ git clone

# for access control
# you'll need to have a RSA/DSA key pair

basic operations

basic day to day work flow

partial commit with staging area (GUI recommended, e.g. GitX)

one afternoon, you made changes to 15 files; now you want to commit it in 3 parts!

$ touch
$ git add

# alternatively, staging patch by patch, interactively
$ git add -p

# this reset the staging area, but leaving the working tree dirty
$ git reset

cleaning up the mess

# just unstage the file, don't overwrite working copy
$ git reset HEAD --

# checkout file from HEAD, overwriting working copy
$ git checkout --

# checkout subdir from old version, overwriting working copy
git checkout v3.25.1 -- path/to/dir

# i committed and pushed something is just broken :(,
# this makes an extra commit that is
# the negatation the changes in badcommit.
$ git revert badcommit

viewing history

# idonethis!
$ git log --author=Hai-Anh --since="12 hours ago"

# list all commits since branch 3.24
$ git log v3.24..master >> release-notes.txt

# did anyone touch the config file?
$ git log v3.24..master -- src/config/

# show file diff against old version
$ git diff

# grepping through history
$ git grep XXX v3.25

too many branches???

use rebase for a linear history

rebase rewrites history, use it for local changes only!

git is flexible, and get the job done

# forgot to commit a new file, but local changes not pushed yet
$ git add
$ git commit --amend

# i want that fix in my branch, now!
$ git cherry-pick ${sha1}

# i was working on feature X, made changes to 10 files
# now i must leave it aside to work on a hotfix
$ git stash save 'partial work on feature X'
$ git checkout -b v2.30.1-hotfix v.2.30.1  # work on hotfix

$ git checkout working-branch
$ git stash pop

Use a spacebar or arrow keys to navigate