I know that, when moving a file, you need to git add the "new" file and git rm the "old"
You can achieve this with a single command
git mv
I only realized this after having pushed multiple commits on top. Is there a way to fix it?
Yes.
Now let's explain in details what and how.
How to rename git files
How does git store files?
First of all, let's understand how git
stores the file names and why there is a "problem" as novice users see it.

Where is the file name?
- Git store full path and not a plural file names.
- The "folder" structure is stored inside "tree" objects.
The file name is stored elsewhere and it will be too long to explain here. in short git store the list of files and their SHA-1
in an object named tree
Git generates the file list (called snapshots) before your commit.
To view the SHA-1
of your files :
git ls-tree -l <commit id>

- Once you commit your changes git will write the data to the tree object


And now that we have explained in short how git store files we can explain what went wrong.
Since git
doesn't care about your file name and they are only used for writing the content to your local file system they are stored elsewhere.
When you "move" a file git see it as a new file and the consequence is a deletion of your "old" file and "finding" a new file

In order to rename your files, you have to use the git mv
command which updates the internal git
storage and move the file to the new location
