From what I understand, Git doesn't really need to track file rename/move/copy operations, so what's the real purpose of git mv
? The man page isn't specially descriptive...
Is it obsolete? Is it an internal command, not meant to be used by regular users?
We use the git mv command in git to rename and move files. We only use the command for convenience. It does not rename or move the actual file, but rather deletes the existing file and creates a new file with a new name or in another folder.
In Git's case, it will try to auto-detect renames or moves on git add or git commit; if a file is deleted and a new file is created, and those files have a majority of lines in common, Git will automatically detect that the file was moved and git mv isn't necessary.
emiller/git-mv-with-history. git utility to move/rename file or folder and retain history with it. # git-mv-with-history -- move/rename file or folder, with history. # Git has a rename command git mv, but that is just for convenience.
git mv oldname newname
is just shorthand for:
mv oldname newname git add newname git rm oldname
i.e. it updates the index for both old and new paths automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With