Postscript:
Git hackers refer to git as "plumbing" and to Cogito and the GUIs as
"porcelains", and they naturally pipe stuff to one another. When
something goes wrong, there's often talk of spillage.
In hindsight, it's a good thing I didn't have time to google for images
to "spice up" the presentation.
Why?
====
- you want to hack on the linux kernel
- or on a cool SCM
- it is fast even on large projects
- it is _small_ even on large projects
- you can work disconnected
- are doing a lot of branched or parallel development
- you want really smart tools to deal with renames, and figuring out
where some code comes from...
- and tools that are _simple_ and don't get in the way
GIT for the solo developer
==========================
... add to your env
GIT_AUTHOR_NAME=Martin Langhoff
GIT_COMMITTER_NAME=Martin Langhoff
GIT_COMMITTER_EMAIL=martin@catalyst.net.nz
GIT_AUTHOR_EMAIL=martin@catalyst.net.nz
... and now to work...
cd workdir
cg-init
...work work work...
cg-diff
cg-commit
cg-add
cg-remove
cg-commit
... you can also do
emacs .gitignore
... all of this happens on a head (branch) called 'master'
cg-status
cg-commit
... oops!
cg-admin-uncommit
... and now either
cg-diff # edit and retry the commit
... or
cg-reset # discard all local changes
Tags
====
cg-tag -s TAGNAME
cg-tag-ls
...and then release based on a tag...
git-tar-tree TAGNAME
Where's git hiding stuff?
=========================
ls .git
HEAD description index objects
branches hooks info refs
Now let's publish it
====================
ssh someserver
mkdir ~/public_html/myproject.git
GIT_DIR=~/public_html/myproject.git git-init
chmod ugo+x ~/public_html/myproject.git/hooks/update
cg-branch-add origin
git+ssh://someserver/home/martin/public_html/myproject.git#master
cg-push
How does someone else work with you?
====================================
cg-clone http://someserver/~martin/myproject.git
cd myproject.git
... hack hack hack...
cg-commit
cg-update origin
cg-commit
mkdir patchesforupstream
git-format-patch --mbox --signoff -o patchesforupstream origin
git-send-email -o patchesforupstream/0001-fixing-ugly-bug
cg-update origin
cg-diff -r origin:master
cg-log -r origin:master
A team with commit rights
=========================
cg-clone git+ssh://someserver/var/git/ourproject.git
# like others: sticky group set and friendly umask!
cd myproject.git
... hack hack hack...
cg-commit
cg-update origin
cg-commit
cg-update
... resolve conflicts if needed ...
cg-diff -r origin:master
cg-log -r origin:master
cg-push
cg-fetch vs cg-update
Get your head around branching
==============================
- We call them heads
- Like DARCS, each repository is a head
- The word "branch" is used for "remote head", like origin
- However! You can have many heads in the same repository:
- a "publishing" repository can have many heads
- a merging repository will know about several heads, to be able to
merge
- most repos only know about one (master) or two (master and origin)
- Each cg-update is a merge. Git remembers how far you've merged,
it'll know next time what's pending.
- Branch merging is stupid+fast first. Falls back to smart
Migrating from CVS or Arch?
===========================
mkdir fooproject; cd fooproject
git-init-db
git-cvsimport -k -d /var/cvs fooproject
mkdir barproject; cd barproject
git-init-db
git-archimport leaddeveloper@archrepo-2005/project
otherdeveloper@secondaryarchrepo-2005/project
Other migration needs? Tailor.py to the rescue... CVS, Subversion,
darcs, monotone, Codeville, Mercurial and Baazar-NG.
Powerful tools, evolving quickly
================================
- Very fast stupid merge
... and very smart, slow merges when stupid won't do
- Rename/copy detection
- Pickaxe
- File identity smarts
- Commits echoed back don't conflict, even if they show up via a strange
path
- StGIT
Pretty GUIs
===========
- gitk, included, fast, powerful, simple.
- qgit -- now with StGIT support
Technical
=========
- Content-addressable FS
- Files -> Tree -> Commit (message + parents) -> Tags
- Heads vs Branches, References
- the Index
- Changeset/patch tracking vs identity-tracking