Renames in Git explained
Introduction One of the questions I’m often asked when teaching or explaining Git is how Git handles file and/or directory renames. The short answer to this is: It doesn’t.
The slightly longer answer is: It does, but probably not in the way you envision it?.
Let’s first take a look at how Git works internally. If you don’t quite understand everything which follows, I can recommend reading chapter 10 of the Git Pro Book 2nd.