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

Hans Johnson hans-johnson at uiowa.edu
Sun Aug 1 17:15:42 EDT 2010


Brad,

I followed instructions for setting up the hooks, and then when it came time
to start working, I setup a dashboard build.  I assumed that the dashboard
build checkout of ITK would have setup the hooks for me also, but they did
not.  I then did a lot of work without recognizing that the hooks were
turned off.

Would it be possible to have the itk_common.cmake setup the git hooks by
default?

Hans

-- 
Hans J. Johnson, Ph.D.
Hans-johnson at uiowa.edu

278 GH
The University of Iowa
Iowa City, IA 52241
(319) 353 8587



From: Bradley Lowekamp <blowekamp at mail.nih.gov>
Date: Sun, 01 Aug 2010 10:42:00 -0400
To: Hans Johnson <hans-johnson at uiowa.edu>
Cc: ITK <insight-developers at itk.org>
Subject: Re: [Insight-developers] Learning from my mistakes (an adventure in
git)

Hans,

Very interesting post with some useful information.

However I would like to avoid getting into the situation you found yourself.
So how did you setup the commit hooks? How do I make sure they are working?

Thanks,
Brad

On Jul 31, 2010, at 12:35 PM, Hans Johnson wrote:

> First let me preface this story:  I am really liking git.  I am now starting
> to see the tremendous power that git is going to provide in managing
> contributions from multiple developers efficiently.  But as spider man¹s uncle
> ben stated  ³With great power comes great responsibility².
> 
> This is documentation of how I dug myself out of a big git hole.
> 
> Did you ever work yourself into a "git" hole so deep that you want to just
> start over?  I did!
> While I was fumbling around in trying every nifty git feature I came across, I
> ended up with such
> a mess that I could not find an elegant way to get out of it.
> 
> Here is what I did after getting scared that all the coding work I did was
> going to be lost due
> my inexperience with git.  I wanted to hit the reset button on git, and
> preserve the coding changes I made.
> 
> I realize that there are more elegant ways to do this, but those methods
> required using tools
> that were not above my current skill level.
> 
> Problems that I ran into:
> 1) I forgot to setup the commit hooks, and some of my commits did not pass
> that test.
> 2) I had the wrong e-mail address listed, so I wanted to fix that.
> 3) I did not understand the branching mechanisms of git very well, so I ended
> up with a bit of a mess.
> 5) My intermediate commits needed to be re-ordered to fit into a more logical
> commit structure.
> 
> 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.
> 
> 
> Step #1
> ========================================
> mkdir ~/mypatches
> git checkout branch1
> git format-patch --outputdir ~/mypatches
> git checkout branch2
> git format-patch --outputdir ~/mypatches
> git checkout branch3
> git format-patch --outputdir ~/mypatches
> 
> #Create patch sets, and then re-apply them as needed.
> git fetch origin
> git checkout master
> git rebase origin/master master
> 
> 
> 
> 
> git branch ITKv4.0A (branches off origin/master)
> git checkout ITKv4.0A
> ##=========
> %  git apply --check --exclude CMakeLists.txt
> /Users/hjohnson/mypatches/0001-Removing-some-outdated-compiler-conditionals.pa
> tch
> %  git apply         --exclude CMakeLists.txt
> /Users/hjohnson/mypatches/0001-Removing-some-outdated-compiler-conditionals.pa
> tch
> ### The --exclude CMakeLists.txt was needed because that file was
> independantly updated on the master branch prior to patching, and made that
> patch unneeded.
> %  git apply --check -v --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0003-Second-pass-at-removing-BORLAND-compiler-refs.p
> atch
> %  git apply         -v --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0003-Second-pass-at-removing-BORLAND-compiler-refs.p
> atch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0004-Removed-ITK_LEAN_AND_MEAN.patch
> %  git apply     
> /Users/hjohnson/mypatches/0004-Removed-ITK_LEAN_AND_MEAN.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0005-Unsigned-type-matching-for-ImageDimension.patch
> %  git apply     
> /Users/hjohnson/mypatches/0005-Unsigned-type-matching-for-ImageDimension.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0006-Removed-__sgi-IRIX-and-SCSL-references.patch
> %  git apply     
> /Users/hjohnson/mypatches/0006-Removed-__sgi-IRIX-and-SCSL-references.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0007-BUG-11075-Removal-of-SPROC-code.patch
> %  git apply     
> /Users/hjohnson/mypatches/0007-BUG-11075-Removal-of-SPROC-code.patch
> %  git add -A; git commit
> 
> ##ITKv4.0B (branches off ITKv4.0A)
> ##=========
> %  git apply --check
> /Users/hjohnson/mypatches/0006-Remove-itkLegacyMacro-references.patch
> %  git apply     
> /Users/hjohnson/mypatches/0006-Remove-itkLegacyMacro-references.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0007-Removed-all-legacy-code.patch
> %  git apply     
> /Users/hjohnson/mypatches/0007-Removed-all-legacy-code.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0002-Removed-Brains2Mask-reader-writer.patch
> %  git apply     
> /Users/hjohnson/mypatches/0002-Removed-Brains2Mask-reader-writer.patch
> %  git add -A; git commit
> %  git apply --check
> /Users/hjohnson/mypatches/0008-Removed-dual-nature-of-Un-Oriented-Images.patch
> %  git apply     
> /Users/hjohnson/mypatches/0008-Removed-dual-nature-of-Un-Oriented-Images.patch
> %  git add -A; git commit
> ## Extra whitespace at end of changed lines of code were causing commit
> warnings
> %  git apply --check --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0009-rm-ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTEN
> TLY.patch
> %  git apply         --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0009-rm-ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTEN
> TLY.patch
> %  git add -A; git commit
> %  git apply --check --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0010-Removed-ITK_USE_DEPRECATED_FAST_MARCHING.patch
> %  git apply         --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0010-Removed-ITK_USE_DEPRECATED_FAST_MARCHING.patch
> %  git add -A; git commit
> %  git apply --check --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0010-Removed-ITK_USE_DEPRECATED_FAST_MARCHING.patch
> %  git apply         --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0010-Removed-ITK_USE_DEPRECATED_FAST_MARCHING.patch
> %  git add -A; git commit
> %  git apply --check --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0011-Removed-ITK_USE_DEPRECATED_LEVELSET_INTERPOLATI
> ON.patch
> %  git apply         --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0011-Removed-ITK_USE_DEPRECATED_LEVELSET_INTERPOLATI
> ON.patch
> %  git add -A; git commit
> %  git apply --check --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0012-Removed-ITK_USE_REGION_VALIDATION_IN_ITERATORS.
> patch
> %  git apply         --ignore-space-change --whitespace=fix
> /Users/hjohnson/mypatches/0012-Removed-ITK_USE_REGION_VALIDATION_IN_ITERATORS.
> patch
> %  git add -A; git commit
> 
> ====
> Cleanup  -- remove old branches (from local repository, and from my personal
> gitHub forked repository).
> 
> git push iowaITK :remove_sgi
> git push iowaITK :remove_sproc
> git push iowaITK :remove_borland
> git push iowaITK :ITK_LEGACY_REMOVE
> git push iowaITK :REMOVE_ORIENTED_IMAGE
> git push iowaITK ITKv4.0A
> git push iowaITK ITKv4.0B
> 
> 
> 
> I hope this is useful to somebody.
> 
> Hans
> 
> -- 
> 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 <x-msg://109/hans-johnson@uiowa.edu>
> PHONE: 319 353 8587
> <ATT00001..txt>



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100801/98498f71/attachment.htm>


More information about the Insight-developers mailing list