In Git bash, I deleted a folder using:
GIT RM -r folder
Then I added a different folder using:
git add .
When I run git status, instead of "added", the new files have "renamed".
Note: The files and subfolders are almost identical.
In Git bash, I deleted a folder using:
GIT RM -r folder
Then I added a different folder using:
git add .
When I run git status, instead of "added", the new files have "renamed".
Note: The files and subfolders are almost identical.
“The files and subfolders are almost identical.” Well that’s why. git sees this as a continuity; in effect you’ve merely moved the files, perhaps with some changes, to another folder. Usually that’s how people want this sort of thing to be understood by git.
If a file has the same hash, it's considered the same file. So, even if you remove and recreate it, it's considered a rename.
And, in fact, I believe Git can also consider two files the same thing if they're only slightly different, based on how much changed in commits between the two actions (delete old and create new). Below a certain ratio, it considers it a rename-and-change rather than a delete-and-create.
What I take from this is that you shouldn't necessarily trust what Git is telling you. It's making a fairly educated guess as to what actually happened.