git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to apply patch in the middle
@ 2009-01-15  1:35 bill lam
  2009-01-15  1:39 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: bill lam @ 2009-01-15  1:35 UTC (permalink / raw)
  To: git

I want to change history to rewrite

  - A - B - C - D - E - ..
 
as

 - A - C' - D - E - ..

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.
Sorry for this newbie question.

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩008 杜甫  望嶽
    岱宗夫如何  齊魯青未了  造化鍾神秀  陰陽割昏曉
    盪胸生層雲  決眥入歸鳥  會當凌絕頂  一覽眾山小

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to apply patch in the middle
  2009-01-15  1:35 how to apply patch in the middle bill lam
@ 2009-01-15  1:39 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-01-15  1:39 UTC (permalink / raw)
  To: bill lam; +Cc: git

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-15  1:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-15  1:35 how to apply patch in the middle bill lam
2009-01-15  1:39 ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).