News for hackers. Stuff that matters.
Re:Can we communally deprecate git checkout? by Izkata on Thursday January 09, 2025 @07:19PM (#42651230)
> copying files within a repo while preserving file history (if you just copy+paste you lose, if you edit the files after moving with git mv, but before comitting the move first, you lose all history)

This is much closer a description to svn (and probably other systems), and doesn't describe git at all. Git doesn't store file renames. It reconstructs them from the history based on how similar an "add" and a "delete" were in the same commit. There's even args to change the sensitivity and look for line sources in even broader scopes* - which means git can do one thing others can't, show you where lines came from when two or more files were merged. Others can only show you one of the source files, the one that was explicitly renamed.

* See "-C" in "git help blame", the broadest scope even looks for the source in other commits.

Re:Can we communally deprecate git checkout? by g-b-r on Monday January 13, 2025 @04:30AM (#42681639)
Except that it can't, and doesn't, always work
Re:Can we communally deprecate git checkout? by bboygravity on Wednesday January 15, 2025 @02:43PM (#42715933)
Exactly. I have never ever had an OS "cut-paste" operation work in a way that git didn't see as entirely new files that it never saw before.

If it did work like that, there would be no reason whatsoever for the "git mv" command to exist.