On Mon, May 12, 2014 at 10:33:48AM +0200, Rainer M Krug wrote:
> Eric Schulte <schulte.e...@gmail.com> writes:
> 
> > Rainer M Krug <rai...@krugs.de> writes:
> >
> >> Bastien <b...@gnu.org> writes:
> >>
> >>> Hi Rainer,
> >>>
> >>> Rainer M Krug <r.m.k...@gmail.com> writes:
> >>>
> >>>> I'll look at it again tomorrow and let you know as I made some changes
> >>>> since then. Do you prefer one patch to several?
> >>>
> >>> Up to Eric's taste -- but in general I think a series of patches
> >>> is better, it allows you to isolate and fix conflicts more easily.
> >>
> >
> > I agree, multiple patches make future maintenance easier.
> >
> 
> OK - I'll do so.
> 
> A little bit off-topic, is there a "git way" of splitting one patch into
> several patches, if it was a single commit?

Do an interactive rebase, and amend.

Say this is the commit graph:

  A---B---C---D

You want to split B.  Then you do:

  $ git rebase -i B~

In the editor that pops out, you choose `edit' for B, leave the others
unchanged.  Then git will checkout A for you, and wait for you to edit.
Now you can apply patch B in parts (by hand).

  $ git show B > patch
  $ # apply part1 of patch (assuming you are breaking it into 2 parts)
  $ git commit -a -m "Message for part1" # lets say this is B1
  $ # apply rest of the patch
  $ git commit -a -m "Message for the rest" # and this is B2
  $ git rebase --continue

Now your commit graph should be like this:

  A---B1---B2---C---D

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

Reply via email to