Saturday, January 8, 2011

Get Git

My job has some wonderful variety... one day I'm scribbling equations, the next I'm freezing my a$$ off in a huge refridgerator at 40 below.  Those are two very different experiences (a statement offered without proof, which is left to the reader).

However, both produce records: handwritten notes from one and binary computer data files from another.  Storing records has always been a challenge; finding them again later is worse. I even wrestle with how to keep organized.  Almost any record is simultaneously a piece of data, a process, and a reference.
I'm fairly certain, though, that any record that required work should not get scrapped.  Ever.

For data I'm loving MySQL, but for processes I think I want a version control system.

Here's a concrete example, I have a simple system level math model of my product, a six speed automatic transmission.  It contains about 100 files.  This is microscopic compared to "real" version controlled projects but I still want:

  • insurance against breakage (due to my own actions)
  • availability as a reference or tutorial for other projects
  • easy parallel branch maintenance 

Looks to me like pretty much any version control system will get me most of that.  Unfortunately that kind of flexibility is not an advantage to a n00b like myself.

Here's how I picked Git:

1.  Git appears to work on a project version, rather than file versions

Most of the VCS options want to maintain a series of file patches that allow you to move from one version to the next (or previous).  The VCS process appears to be

  1. invent or "bless" an initial version
  2. check out copies of files, make changes to them, and
  3. check in the results and update the database

Transactional databases would probably do the same things for me, but diff tools etc are already built into good a VCS.  Neither one is going to like my habit of swapping information environments and tools, however.
Running a DIFF between an M script and a binary data file or compiled C doesn't sound meaningful.
Other VCSs want to track changes to files; Git's philosophy appears to be more like, track changes in a directory - not a great example but somewhat descriptive..

Git fundamentally looks more flexible.

2.  Git is a distributed system.

I'm trying to become more agile.  In my experience, centralized authority pretty much opposes agile.
For example, ten or fifteen years ago, some engineers would ask a secretary to type reports for them.  It was a serious bottleneck compared to today, where everybody types up their own garbage.

Similar comparisons are available from Labs & Shops environments, or the I.T. department, or pretty much any process where there's a limited number of people who are actually working as compared to the number of people requesting work.  There's a wide variety of parallels, at least philosophically, where a distributed model is more more productive and more robust than a centralized model.

Combining that observation with the expected level of management chain support... well, a distributed system makes more sense.

Git!

- nzvyyx

ps [update 1MAY11] 
I prefer NotePad++ for lightweight file editing (it grandfathers my OS-independent rule), and since Der Kompanie removed BeyondCompare I was forced to find another diff/merge tool:  DiffMerge won.


Given the trial-and-error work I did and the various Google sidetracks involved, I thought it might be helpful to post the resulting .gitconfig options that worked on my WinXP machine:


For NotePad++:

[core]
  editor = <your_personal_path_to>notepad++.exe
  whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
  autocrlf = false


For DiffMerge:

[merge]
  tool = diffmerge
[mergetool "diffmerge"]
  cmd = <your_personal_path_to>DiffMerge.exe --merge -- result=$MERGED $LOCAL $BASE $REMOTE
  trustExitCode = true


You can get all of that done via mutliple git config --global commands at the prompt, or you could just copy the stuff above directly into .gitconfig file directly (e.g., open it in Notepad++). 


If it works, then git mergetool should give you an option to open DiffMerge.  Good Luck!


- nzvyyx

No comments:

Post a Comment