In vscode, I have installed [Wayback/Archive] git-rename – Visual Studio Marketplace (with source code at [Wayback/Archive] adam8810/vscode-git-rename: Move or rename a file, a directory, or a symlink using git-mv).
Many people assume that git does recognise rename (or mv) operations by itself. Often it does, but it fails, and when it fails it usually is in a complex situation where it is easy to overlook it did not recognise the rename.
Failing complex situations I have encountered in the past (combined they get worse):
- rename across several directories
- first edit, then rename
- first rename, then edit
So it is better to proactively perform an IDE-assisted git mv
operation that informs git of the rename.
Many IDE environments support a built-in rename that keeps git mv
in the loop, but Visual Studio Code does not, hence the need for this extension.
It means I agree with the question, disagree with the answer, and agree with the comment in [Wayback/Archive] VS Code ‘git mv’ to preserve file history? – Stack Overflow: