From: Junio C Hamano Date: Sun, 03 May 2026 21:59:47 GMT Subject: Re: git rename/moved status unreliable in ruby Message-ID: In-Reply-To: <026b84f4-7052-4d5b-a9ae-c2487569d1ee@gmail.com> Phillip Wood writes: > Hi Sebastien > > On 01/05/2026 06:05, sebastien.stettler wrote: >> 1. What did you do before the bug happened? (Steps to reproduce your issue) >> >> when moving ruby classes between namespaces they are marked as new files and the old >> ones are marked as deleted >> >> if i only change the class name it will mark it as renamed > > Rename detection is based on how similar the two files are. Looking at > the example you linked to below you're changing a file that looks like > ... > Which means that git sees that every line has changed because the > indentation has changed. If you want git to realize that the file has > been renamed you could move it in one commit and then add modify it in > the next commit. I've seen this repeated many times, but it is misleading to give it without qualifying when that "works" and when it does not. Such a "stick to pure rename and make huge changes elsewhere" strategy would help your "git log -M [--follow]" and possibly "git rebase", but it would not help all that much if you are doing "git diff" or "git merge".