Re:Ask HN: Can we do better than Git for version control?
by shard_ on Sunday December 10, 2023 @05:37PM
(#38595758)
`git mv` is just shorthand for `git rm` and `git add`. All Git knows is that there was a file called `oldfile` and there's now a file called `newfile`, and whether or not they have similar contents or filenames. It's only when you run `git status` or `git diff` or whatever that it actually tries to guess if anything was renamed. So what you're seeing isn't the rename being recorded in history but just that guess being correct. It's easy for it to become incorrect if you make some nontrivial changes or have multiple similar files.
[ Parent
| on HN ]
Re:Ask HN: Can we do better than Git for version control?
by creatonez on Sunday December 10, 2023 @08:10PM
(#38596619)
The parent comment's suggestion is to commit each of these moves individually, which should guarantee that the detection algorithm will get it right. Will definitely pollute your history, though.