stringham / move-ts

A Visual Studio Code plugin for updating relative imports when moving typescript files and folders in your workspace.
MIT License
52 stars 15 forks source link

Use Git Mv #21

Open jelling opened 6 years ago

jelling commented 6 years ago

This extension would be even better if it did a Git move either by default, or by configuration, when moving files. Right now it marks the old file name as deleted and adds a new file. This makes viewing the real history in Git much harder.

rgammans commented 5 years ago

I pretty sure git dpesn't record move in any special way; so shouldn't make a difference if you use git mv or not.

This SO question backs me up:- https://stackoverflow.com/questions/2314652/is-it-possible-to-move-rename-files-in-git-and-maintain-their-history

When you do moves;though you want to keep the other changes to the moved file as small as possible so the git rename detection 'magic' works.

quezak commented 5 years ago

Even if it doesn't make a difference, there could be an option to do git mv (or git rm + git add) automatically, to avoid having to manually marking the file as moved later.

csojinb commented 4 years ago

@rgammans Using git mv does add both the deletion and the new file into the staging index, meaning that if you subsequently make changes to the new file, those changes are trivially kept separate from the move itself (until you stage the changes) and may make it easier create a commit history that maintains git's knowledge of the file history, even if you forgot to commit immediately after doing the rename.