Changing File Names In A Git Repository Without Loosing File History

Git tracks files by where they are in the directory structure. This creates unintended commits and losses of file history when renaming directories. There are two good solutions I’ve found for these issues, depending on the circumstances.