Why would a simple `git mv` fail?
I am trying to rename a file in a local
git mv MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c
Yet, git fails with:
fatal: renaming 'MyProj/src/ts0621/foobar.c' failed: No such file or directory
I could swear that I had
git mv working for me when renaming a subdirectory, but for some reason a simple rename of a file doesn’t work. Why?
(I, of course, verified that the file
MyProj/src/ts0621/foobar.c exists before attempting to issue this command)
2 Solutions collect form web for “Why would a simple `git mv` fail?”
Probably, because NewProjName/src/ts0629 doesn’t exist
mkdir -pv NewProjName/src/ts0629 git add NewProjName/src/ts0629
add -f , if the path is relative, to increase
git mv -f "originPath" "newPath"
git mv -f MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c