News for hackers. Stuff that matters.
Re:What comes after Git by Akronymus on Tuesday July 05, 2022 @02:42AM (#31985095)
Would it make sense to make one commit for the move and one for the changes?
Re:What comes after Git by jraph on Tuesday July 05, 2022 @03:02AM (#31985218)
I wish I didn't have to think about it and git supported file renaming properly so a unit of change that hasn't much sense when it is split can stay a unit, but without it yes, I think it makes sense to commit renames separately so history can be tracked more easily.

I think git can be configured on how hard it tries to find renames from similarity between a deleted file and an added file.

Re:What comes after Git by kruador on Tuesday July 05, 2022 @07:03AM (#31986726)
No, it makes no difference. Git doesn't look at the full history when performing a merge, it just looks for similarity between the paths and files in the commits being merged, and the common base commit (which you can discover by running `git merge-base`). It doesn't keep any metadata about whether something was a move: as far as the actual data structures are concerned, you deleted file a/b/c and added file d/e/f, that have the same file content hash.

You can find more information on how Git now does it at https://blog.palantir.com/optimizing-gits-merge-machinery-1-... . I think this first started to be released in v2.31.0, and completed in v2.33.0. v2.34.0 switched the default merge strategy to the new 'ort' strategy mentioned in that blog.

Re:What comes after Git by avar on Tuesday July 05, 2022 @09:03AM (#31987708)
The "git log" "follow renames" logic isn't the same as conceptually related merge logic.

I think there are unfortunately still cases where what the GP is suggesting improves the UX, i.e. I think some shortcuts are taken when following a file if the content doesn't change.

IIRC this matters particularly for very large renames, at some point during revision walking we'll give up trying to match your A.txt to B.txt, but if they're the same...

Re:What comes after Git by tsimionescu on Tuesday July 05, 2022 @04:13AM (#31985674)
No, because you often have to make changes to the file to get it to compile after loving to a new location. It's much more annoying to review history with changes that can't possibly compile.
Re:What comes after Git by kadoban on Tuesday July 05, 2022 @04:20AM (#31985720)
This isn't necessarily an issue, depending on what you mean by "review". The one case I really run into is bisects, but even for that you can tell it to just skip commits that won't build.
Re:What comes after Git by bloak on Tuesday July 05, 2022 @03:37AM (#31985434)
Yes, in some cases, but it depends on your workflow. Some projects require each commit on the main branch to be fully working and pass all the tests.