开发者

Why would a simple `git mv` fail?

I am trying to rename a file in a local .git directory:

git mv MyProj/src/ts0621/foobar.c NewProjName/src/ts0629/foobar.c

Yet, git fails with:

fatal: renaming 'MyPro开发者_开发问答j/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)


Probably, because NewProjName/src/ts0629 doesn't exist

Try

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜