public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce•org>
To: bill lam <cbill.lam@gmail•com>
Cc: git <git@vger•kernel.org>
Subject: Re: how to apply patch in the middle
Date: Wed, 14 Jan 2009 17:39:13 -0800	[thread overview]
Message-ID: <20090115013913.GC10179@spearce.org> (raw)
In-Reply-To: <20090115013535.GB6937@b2j>

bill lam <cbill.lam@gmail•com> wrote:
> I want to change history to rewrite
> 
>   - A - B - C - D - E - ..
>  
> as
> 
>  - A - C' - D - E - ..

Uh, "git rebase -i A", change "pick" on line "C" to "squash".
This should have the same impact as what you are trying.

> because rebase/squash cannot automatically resolve conflicts, I
> generate a patch file from A to C
> 
>   git diff A C >pat
> 
> However I don't know how apply this patch and cancel the old B and C.

One way you can insert this is:

  git rebase -i A^
  change "pick" on line "A" to "edit"
  delete lines "B" and "C".

  when it stops for amend, don't amend.
  git apply --index pat
  git commit -m "my new B and C"
  git rebase --continue

-- 
Shawn.

      reply	other threads:[~2009-01-15  1:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15  1:35 how to apply patch in the middle bill lam
2009-01-15  1:39 ` Shawn O. Pearce [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090115013913.GC10179@spearce.org \
    --to=spearce@spearce$(echo .)org \
    --cc=cbill.lam@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox