将除一个文件夹外的所有文件夹移动到子目录 - git

Moving all but one folder to sub-directory - git

我有一个 git 与 Github 同步的存储库,结构如下。

~/Data_Store/
~/Data_Read/
....
...
~/R/

.git 文件夹在 ~/

我希望达到以下最终状态。

文件夹结构我已经做好了,如下图:

~/ghubrepo
~/bbrepo
~/R
~/.git

我现在卡住了。 git status 显示所有文件已删除(~/R/除外)所以我不敢提交。

对前进的道路有什么建议吗?

您需要先移动现有的存储库,以避免 git status 向您显示 "everything is deleted"。

mkdir ~/ghubrepo
mv ~/* ~/ghubrepo # you might have a warning stating that it cannot move
                  # ghubrepo in itself
mv ~/.git ~/ghubrepo

然后你可以继续结构的其余部分。

但首先,请检查 ~/ghubrepo 中的 git status 是否符合您的预期。