In a git working tree, I have a file "foo". I have made significant modifications to this file, then renamed it to "bar". Git detects this as a deleted/new file. According to this answer, in order for git to detect that they are the same file, the move should be committed first, then the modification. Given that the file is already modified and moved (but not yet staged or committed), what is the procedure to follow to commit the move operation first, then the modification (ensuring I don't lose my modifications in the process)?
Similarly, what is the procedure to do this if the move/modification has already been committed in a single commit?