Re: how to reorder commits

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

 



On Mon, 20 Jul 2009, Rustom Mody wrote:

> I have a sequence of commits. I tried to reorder the top two in this way.
> $ git rebase -i HEAD^^
> 
> flip the two pick lines and exit vi
> 
> I find my file full of conflict markers.
> So what is the way of doing:
> HEAD becomes current HEAD^
> HEAD^ becomes current HEAD
> without having to handle conflicts ??

Note that what you're asking for here would add both changes in HEAD^ and 
*remove* some changes in HEAD (to get to the state where only the change 
that was made first has been made).

What you tried with rebase is correct, but if your changes in those 
commits intersect, impossible to do automatically:

Original:

 This is an example.

Change 1:

-This is an example.
+This is a better example.

Change 2:

-This is a better example.
+This is a better sentence.

Now, make change 2 without change 1. Even if you can split the changes as
(1) "an"->"a better"; (2) "example"->"sentence", you get:

 This is an sentence.

When the correct version would be:

 This is a sentence.

But there's no automated way to know this, so you get conflict markers.

	-Daniel
*This .sig left intentionally blank*
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]