move all files of current directory into subdirectory and maintain history

前端 未结 7 1088
不知归路
不知归路 2021-02-05 03:00

How can I move all the files of my current directory into a new directory and retain the history.

I have tried:

git mv . old_app

But I

7条回答
  •  清酒与你
    2021-02-05 03:45

    I just stumbled across this error message and apparently the solution is quite simple.

    But first of all remember there is the mv and the git move.
    The normal bash move usage is: mv * ./subDir which will only produce a warning but still move your files.

    Whereas the git mv with the usage git mv * ./subDir will produce the fatal error and abort the move:
    fatal: can not move directory into itself, source=currentDir/subDir, destination=currentDir/subDir/subDir

    The solution to make the git mv work is simple:
    git mv -k * ./subDir The option -k will simply skip all actions that would produce an error.

提交回复
热议问题