Dec 032009
 

I’ve taken longer than many to get comfortable with git. I’ve become very comfortable with quilt and git consistently behaved non-intuitively (for me). A couple months back someone pointed me at “git rebase -i” – the clouds parted, heavenly rays shone down upon me, and all was well once again in the Zion in my head.

With quilt you work with patches, and you really need to have them well defined in your head before you start. You can get away with some lack of planning if your various patches are restricted to distinct files. More often than not for me however, my patch series work on a single file, or maybe two or three. Merging patches in quilt is … well … just like merging patches without quilt … a flurry of filesystem commands and manual merging.

With git, you work with the source, and generate the patches from your changes. The git motto “commit often” is key to success here. I can start a project with only a rough idea of what needs doing and commit small changes along the way. When the project is done, I may have dozens of commits in my local git tree, none of which are functionally complete, and most likely won’t even compile. With “git rebase -i” I can rearrange these patches, merge them, annotate them, and generate a series suitable for submission to LKML. Ahhhhh. I git it! Finally.

  2 Responses to “Git Rebase – The Missing Link”

  1. The other totally magic command is “git add -i” which lets you select (even down to the line level) which changed bits to include in a given commit. Learn to love it.

  2. Ooooh, coool. I’ve been meaning to look into that patch hunk selection. Thanks for the tip Dave!

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>