When renaming a file, rename it using git if in a repository
- VSCode Version: 1.0.0
- OS Version: OS X El Capitan
Steps to Reproduce:
- Rename a file via the sidebar
Expected result:
- Git registers the rename (ie. when using
git mv)
Actual result:
- Git doesn't recognize the operation as a rename, but rather thinks the file with the old name was deleted, and the renamed file appears untracked.
@stereokai not if you stage the change though, right?
@bpasero Well, if you git mv any file, it gets staged consequently. Is that what you mean?
This behavior is present in WebStorm by default, for example.
@stereokai yeah so git typically is smart enough to detect a rename even if you do it from the file system as soon as you stage the change. Otherwise any 3rd party tool that is not aware of git would not cause a git mv in the end.
@bpasero Well, as I described, unfortunately with VSCode git doesn't recognize a rename.
To be clearer, once I stage a VSCode rename, it doesn't show as a rename in git, but as a deletion and a new file.
@stereokai makes sense, I think this only happens though if the 2 files have so many changes that git does not recognize they are the same.
No changes, only rename
Try for yourself :) On May 5, 2016 7:02 PM, "Benjamin Pasero" [email protected] wrote:
@stereokai https://github.com/stereokai makes sense, I think this only happens though if the 2 files have so many changes that git does not recognize they are the same.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/Microsoft/vscode/issues/6127#issuecomment-217195190
Is someone working on it ?
I am strongly opposed to the IDE making any implicit changes to the staging area of my git repositories (i.e. the index). I frequently use it as a scratchpad that I compare against, and when an IDE makes changes to it in the background I have lost work, incorrectly committed files, and/or been unable to correctly review my local progress. Three operations in an IDE which I expect to be able to complete without affecting the staging area of a Git repository are:
- Deleting a file in the Explorer view (or equivalent in other IDEs)
- Renaming a file in the Explorer view
- Adding a file in the Explorer view
Note that Git is not like Subversion where file renames need to be tracked using special commands for it to work. The git-mv command does not have any impact on the ability/behavior of Git in tracking renamed files. The only thing it does is automatically update the staging area (index) rather than waiting for a user to do it explicitly.
The same problem to me. VSCode version: 1.11.2. Windows 10
I have the same problem. VSCode version: 1.11.2. Windows 10
@stereokai @rodison @lironess I had the same problem until I realized that the git does not erase the history of the changes anyway, no matter that the file is shown as deleted and created again. The history of changes will not be lost. So there is no more problem for me.
@radziksh Thanks for that link. It actually makes it clear the git mv does nothing special, and it's all in the hands of Git to be aware of file renames. Thanks!