Re: How to effectively undo a part of a commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill Lear wrote:
So, starting with F, he applies delta 1 to get F2.
Then, he applies delta 2 to get F3.

And delta 2 reverts delta 1 again, right?

He says that using cvs he would do something like this:

% cvs update -j F1 -j F2

To apply delta 1 to F3.

try git-cherry-pick -n F2.

We tried using git to get the delta 1 as a patch --- that went fine.
Then we used git-apply to apply the patch, but it refused, and it was
obvious that the line numbers of the patch no longer corresponded to
the line numbers in the file in his working tree.

patches don't care about line numbers (at least not so much).  you probably have overlapping changes, so apply can't work without generating a collision.  try git-apply --reject and then merge the .rej file.

Is there a way in git to do this, or is this an inherently unworkable
problem, as for some reason, I suspect?

there are plenty of ways.  i think you could also do something like this (untested):

git checkout F3
git branch fixF3 F1
git reset --soft fixF3
git commit
git checkout F2
git cherry-pick fixF3

which first transplants F3 back on F1, removing the delta which reverted F2.  then, having a nice patch now, applies it onto F2.

cheers
 simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]