3 ms·
Because git stores sets of files. If you move a file and make a new commit, it's just a new set of files which says "this old set is my parent". There is nothi
by kazinator 8y ago
Because git stores sets of files. If you move a file and make a new commit, it's just a new set of files which says "this old set is my parent". There is nothing in there about the renamed file.
- pmoriarty 8y agoStill, at the point you do a "git mv", it can't be said that git doesn't know you renamed a file. It knows. In fact, after a "git mv foo bar", if you do a "git status", you'll see: On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) renamed: foo -> bar If git chooses afterwards to discard that information and do nothing with that knowledge, that's a separate problem.
- kazinator 8y agoI don't know enough about Git internals in this regard, but it's possible that in fact the index is just being compared to HEAD to infer that information. Index has a file called "bar" and none called "foo". HEAD is vice versa.