git does a great job of moving / renaming directories, but to keep track of changes in these renames, you may need to add some additional parameters to any command you use, or set a few configuration parameters.
The reason for this is that git simply preserves the state of the tree with each commit, and not the changes that have occurred in order to transition from one state to another. If you have many files in the source tree, you may need to tell git to actively try to find any renames. Similarly, if you are interested in a particular file, you need to explicitly specify git to search for possible renames in the past.
To give an example of the latter, a typical case uses git log -- filename to examine the history of a particular file. To tell git to also look for its history before any renaming that might occur, you need to do:
git log --follow -- filename
As another example, the useful output of git log --stat may not include all of your renames or copies if you have many files in your tree, as you need to check all pairs of files for this. To force git to detect copies and rename when using git log and git diff , you can set the diff.renameLimit configuration diff.renameLimit to at least the number of files in your tree and set diff.renames configuration diff.renames to copies - this means detecting copies and renaming.
Alternatively, if you do not want to set them as configuration parameters, you can use the -M or -C options for git log or git diff . They are described in more detail in Jakub NarΔbski, answering this question:
source share