[Insight-developers] Learning from my mistakes (an adventure in git)

Hans Johnson hans-johnson at uiowa.edu
Mon Aug 2 10:29:16 EDT 2010


Brad,

I like this solution!  I think it covers a very common case where developers
who need to do a quick fix turn to their existing dashboard builds to test
something out.

This information is very helpful.

Hans



On 8/2/10 8:35 AM, "Brad King" <brad.king at kitware.com> wrote:

> On 08/01/2010 05:15 PM, Hans Johnson wrote:
>> Would it be possible to have the itk_common.cmake setup the git hooks by
>> default?
> 
> That script is for creating dashboard builds, not developer clones.
> I prefer to keep it focused.  However, I just pushed out a change
> to handle this:
> 
>   http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=311e2ee1
> 
> Now after running CMake if you try to commit to your ITK clone it
> will fail with instructions to install the hooks.  This should prevent
> folks from accidentally creating commits without the local hooks.
> 
>> Problems that I ran into:
>> 1) I forgot to setup the commit hooks, and some of my commits did not pass
>> that test.
> 
> The above should handle this in the future.
> 
>> 2) I had the wrong e-mail address listed, so I wanted to fix that.
> 
> One of the local hooks verifies that you have *an* email address set.
> If you had the wrong one you can fix the most recent commit using
> 
>   git commit --amend --reset-author
> 
> after fixing your "~/.gitconfig".  To fix more commits, use "git rebase -i"
> and change the "pick" lines to "edit".
> 
>> 3) I did not understand the branching mechanisms of git very well, so I ended
>> up with a bit of a mess.
> 
> Have things cleared up for you?  The way I keep track of things is to
> always remember that history is a *graph* (DAG).  Git's "branches" are
> really just references to nodes in the graph.  A commit on a branch just
> creates a new node and moves the branch reference forward to it.
> 
> 4) Off-by-one error in the index for problem 5 :)
> 
>> 5) My intermediate commits needed to be re-ordered to fit into a more logical
>> commit structure.
> [snip]
>> In order to do this, I took my non-logical branches, and created a
>> complete patch set from them to disk, and then started re-importing
>> the patches in a organized progression.
> 
> FYI, your procedure can be simplified using
> 
>   git rebase -i
> 
> and
> 
>   git rebase --whitespace=fix
> 
> -Brad

-- 
Hans J. Johnson, Ph.D.
Assistant Professor
200 Hawkins Drive
T205 BT, The University of Iowa
Iowa City, IA 52242

hans-johnson at uiowa.edu
PHONE: 319 353 8587



More information about the Insight-developers mailing list