How to move files while maintaining history?
Hi folks,
I'm currently looking at a PHP rector script to convert Joomla extensions from version 3 to the namespaced version 4+ of the CMS. The difference is moving files from for example components/com_test/views/test/view.html.php to components/com_test/src/View/Test/HtmlView.php and in the file to rename the class and add a namespace. The script can be run in a git repo or in a complete Joomla installation and it only uses standard filesystem operations.
The problem is now that git doesn't understand that the files are just moved files with tiny changes and I'm wondering how I can teach that to git. PHPStorm is able to keep that relation when you do all the changes by hand, but when I run the script, git loses the history and marks the original file as deleted and the moved file as a new file. I'm now wondering if I can somehow use a different method to move the file to keep that history or if it simply compares the hashes of the file and when I would move the file, commit and then do the code-changes would keep the history.
Anybody got an idea?