将除一个文件夹外的所有文件夹移动到子目录 - git
Moving all but one folder to sub-directory - git
我有一个 git 与 Github 同步的存储库,结构如下。
~/Data_Store/
~/Data_Read/
....
...
~/R/
.git 文件夹在 ~/
我希望达到以下最终状态。
- 当前 repo 移动到 ~/ghubrepo/
中名为 ghubrepo 的新文件夹
- 在 ~/bbrepo/
中创建了一个名为 bbrepo 的链接到 BitBucket 的新存储库
- 在 ~/ 中保留 ~/R/ 文件夹(不同步到任何 repo)
文件夹结构我已经做好了,如下图:
~/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
是否符合您的预期。
我有一个 git 与 Github 同步的存储库,结构如下。
~/Data_Store/
~/Data_Read/
....
...
~/R/
.git 文件夹在 ~/
我希望达到以下最终状态。
- 当前 repo 移动到 ~/ghubrepo/ 中名为 ghubrepo 的新文件夹
- 在 ~/bbrepo/ 中创建了一个名为 bbrepo 的链接到 BitBucket 的新存储库
- 在 ~/ 中保留 ~/R/ 文件夹(不同步到任何 repo)
文件夹结构我已经做好了,如下图:
~/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
是否符合您的预期。