2010-01-07

Git Notes

My notes, links and annotations for GIT and using it with a central Subversion/SVN repo

Intros to git:

Working with git and Subversion:

Blogs, Opinions:

Books:

ONGOING NOTES:

my development procedure (to be completed and tested):
  • setup git repo by cloning (only) the subversion trunk (but full history!)
  1. cd d:/git
  2. git svn clone http://svn1.sbb.ch/polar/client/trunk
  3. cd trunk
  • create a branch for own work
  1. git checkout -b test3
  • get updates from subversion
  1. frequently (daily?) run "git svn fetch" to pull changes into the remote branch without doing anything - slow because svn need to create diff sets for each change. Run in background.
  2. rebase/merge master frequently "git svn rebase -m" - puts master and svn in sync
  • merge branch locally
  1. git checkout master // switch to workspace to master
  2. git merge test3 // merge changes from test3 branch
  3. git mergetool // to handle conflicts using the graphical tortoisemerge
  4. git add // mark merge conflicts as resolved
  5. git commit -m "manually merged conflicts"
  • commit to subversion
  1. ensure master branch and remote git-svn are in sync (git svn rebase -m)
  2. git svn dcommit
  3. empty directories in svn must be manually removed
Observations:
  • initial clone for our client/trunk SVN takes several hours (~4h for 2000 revisions)
  • fetch, update or rebase takes quite a while (up to 1h - many svn changes because of experiments with mvn release)

Useful-looking at first glance, yet to grok:
git helper scripts
git ready
merging screencast
(video 10 minutes)

Noteworthy features of git:
  • merges that work unless there really is a conflict
  • speed
  • staging/index - ability to work on multiple things and separate a commitable set from the resulting mixture of changes, even if changes affect the same files
  • easy addition to the most recent commit, shuffling and reordering of commit chunks after the fact
  • gitk visual representation of all branches, changes, merges
  • distributed - not very relevant in central-SVN context, although useful for local feature branches