threads / discuss / 15892

Rerunning merge on a single file

Subject: Rerunning merge on a single file

## tl;dr

4 messages between Oct 14, 2008 and Oct 14, 2008.

replies: 3people: 2as markdown or json

Kristian Amlie· Oct 14, 2008, 12:13 UTC · lore
Hey, I have question about advanced merging.

Suppose I have a huge merge with conflicts all over the place. There is no way to avoid them, so I start working from the top. At some point, however, I make a mistake and lose the merge information for one file (for example by checking out the file from HEAD).

In that case I would like to get the conflict markers back, and do that file over again, but I don't want to throw away the rest of the index state. Currently the only way I can see to do this is by checking out several file versions under different names and then using git merge-file on them.

Is there a better way to achieve this?
Kristian
Santi Béjar· Oct 14, 2008, 12:21 UTC · re: Kristian Amlie · lore

Re: Rerunning merge on a single file

On Tue, Oct 14, 2008 at 2:13 PM, Kristian Amlie <kristian.amlie@trolltech.com> wrote:

Show 13 quoted lines
> Hey, I have question about advanced merging.
>
> Suppose I have a huge merge with conflicts all over the place. There is no
> way to avoid them, so I start working from the top. At some point, however,
> I make a mistake and lose the merge information for one file (for example by
> checking out the file from HEAD).
>
> In that case I would like to get the conflict markers back, and do that file
> over again, but I don't want to throw away the rest of the index state.
> Currently the only way I can see to do this is by checking out several file
> versions under different names and then using git merge-file on them.
>
> Is there a better way to achieve this?
If the different versions are still in the index you could use:
$ git checkout --merge $file
Santi
Santi Béjar· Oct 14, 2008, 12:28 UTC · re: Santi Béjar · lore

Re: Rerunning merge on a single file

On Tue, Oct 14, 2008 at 2:21 PM, Santi Béjar <santi@agolina.net> wrote:
Show 19 quoted lines
> On Tue, Oct 14, 2008 at 2:13 PM, Kristian Amlie
> <kristian.amlie@trolltech.com> wrote:
>> Hey, I have question about advanced merging.
>>
>> Suppose I have a huge merge with conflicts all over the place. There is no
>> way to avoid them, so I start working from the top. At some point, however,
>> I make a mistake and lose the merge information for one file (for example by
>> checking out the file from HEAD).
>>
>> In that case I would like to get the conflict markers back, and do that file
>> over again, but I don't want to throw away the rest of the index state.
>> Currently the only way I can see to do this is by checking out several file
>> versions under different names and then using git merge-file on them.
>>
>> Is there a better way to achieve this?
>
> If the different versions are still in the index you could use:
>
> $ git checkout --merge $file

Note that this is very new, as it was introduced in v1.6.0.1-26-geac5a40, so you'll need at least 1.6.0.2.

Santi
Kristian Amlie· Oct 14, 2008, 12:48 UTC · re: Santi Béjar · lore

Re: Rerunning merge on a single file

Santi Béjar wrote:
Show 19 quoted lines
> On Tue, Oct 14, 2008 at 2:13 PM, Kristian Amlie
> <kristian.amlie@trolltech.com> wrote:
>> Hey, I have question about advanced merging.
>>
>> Suppose I have a huge merge with conflicts all over the place. There is no
>> way to avoid them, so I start working from the top. At some point, however,
>> I make a mistake and lose the merge information for one file (for example by
>> checking out the file from HEAD).
>>
>> In that case I would like to get the conflict markers back, and do that file
>> over again, but I don't want to throw away the rest of the index state.
>> Currently the only way I can see to do this is by checking out several file
>> versions under different names and then using git merge-file on them.
>>
>> Is there a better way to achieve this?
> 
> If the different versions are still in the index you could use:
> 
> $ git checkout --merge $file

In my case the files were added to the index already, so I guess it doesn't work then?

Kristian

← back to recent threads