Rename via Move
Please add a "Rename" menu option to move a file to a new file name using git mv
:+1:
It's really frustrating to loose tracking on my files because i'm using the ide to rename rather than git mv.
I'd love to see it conditionally over ride the rename option in the side panel file browser context menu as well. :)
Agree. Current workaround is to use the command 'Git: Custom Command' and write: mv <SourceFileName> <TargetFileName>
Package seems to take the working directory from the file that is opened.
For future developer. This "Git: Move", "Git: Rename" or "Git: Move/Rename" should act on the opened file.
I do agree this would be a convenient thing to have.
That said, you shouldn't actually be losing any tracking -- git mv is literally a convenience shorthand. From the Git FAQ:
Git has a rename command git mv, but that is just for convenience. The effect is indistinguishable from removing the file and adding another with different name and the same content.
That's correct.
By "lose tracking" I meant:
- Running git status shows a file as deleted and a file created. I usually stage changes with "git add -u" which will pick up a rename but won't handle a creation/deletion (nice safety). Not the end of the world but it is another opportunity to hastily forget to include a file.
- The situation kemayo mentioned; running gitk filename shows the newly created files history but not history form before the file which the new file was created from. It always logs changes by the filename they occurred on rather than grouping them (at least when viewed with gitk). Turns out I was mistaken and this is just the way git works.
Hmm I did not know that. So even if a large file is renamed using 'git mv' there will be two copies of the same file somewhere in the server's repository? That sucks,
Yea, just doesn't pair well with "git add -u". The old one is deleted and you can stage that deletion you just have to do so explicitly.