git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Branch merge bug

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jan 19, 2010, 13:58 UTC
Message-ID
<4B55BA8B.5010600@drmicha.warpmail.net>
In-Reply-To
<20100119123915.GB28667@inner.home.ulmdo.de>
Andreas Krey venit, vidit, dixit 19.01.2010 13:39:
Show 31 quoted lines
> On Tue, 19 Jan 2010 13:07:28 +0000, Michael J Gruber wrote:
> ...
>> If you really mean to modify and rename an existing file, then tell Git so:
>>
>> git mv fil fila
>> git commit -m 'we need a new name'
>>
>> instead of your 'git rm fil' will record your intentions (not only for
>> Git, but also for everyone else reading your log, such as you a year
>> from now) and will make the merge succeed.
> 
> The intention would only be known informally in the commit message,
> as 'git mv' just removes the old and adds the new file, and still
> leave the work to the rename detection.
> 
> Indeed, changing
>   >: git rm fil
>   >: echo asjhdajkhsdkajhs >fila
>   >: git add fila
> to
>   >: git mv fil fila
>   >: echo asjhdajkhsdkajhs >fila
>   >: git add fila
> and even to
>   >: git mv fil fila
>   >: git cm 'other mv'
>   >: echo asjhdajkhsdkajhs >fila
>   >: git add fila
> still gives the same rename/delete conflict because the rename
> detection does not look at every single commit but only at
> the total changes.

Well, the solution I proposed (mv + commit rather than rm) certainly works for me, I tested it before. I have diff.renames=copies in my config but I don't think it should matter.

Michael
Previous: Ramkumar Ramachandra
Message 5 of 5 in “Branch merge bug”
  1. Ramkumar RamachandraJan 19, 2010
  2. Michael J GruberJan 19, 2010
  3. Andreas KreyJan 19, 2010
  4. Ramkumar RamachandraJan 19, 2010
  5. Michael J GruberJan 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.