What is actual difference in results when it comes to source control systems, between running a command like:
git mv <src> <dest> // see: https://git-scm.com/docs/git-mv
versus a "lower" level command like
mv <src> <dest>
is there any difference in the result from a version/source control system's perspective? Or anything/anyone's perspective?
The same goes for other git commands like git rm
. I just want to know what difference it makes between running the git functions versus bash functions, or whatever.
git mv
stages the move, so you can just git commit
afterwards. If you move the file manually, you need to manually stage the move before committing.
Other than that, there is no difference there is just the minor difference Leon's answer covers. The documentation for git mv says:
Move or rename a file, directory or symlink.
...
The index is updated after successful completion, but the change must still be committed.
Just an extra piece of information, complementing the other answers (this applies solely to giv mv
):
If file <dest>
exists (no matter tracked or not) then
mv <src> <dest>
will silently overwrite it, whereas
git mv <src> <dest>
refuses to overwrite it, with the following error message:
fatal: destination exists, source=<src>, destination=<dest>
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