将.git仓库移至父目录
问题描述:
我有一个名为"www"的子目录,它是一个存储库:
I have a subdirectory named "www" that is a repo:
site
|-- www/
| |-- .git/
| |-- index.html
|-- design/
| |-- images.jpg
我想将存储库更改为父目录,以使存储库结构镜像原始文件结构,如下所示:
I'd like to change the repo to the parent directory so that the repo structure mirrors the original file structure as follows:
site
|-- .git/
|-- www/
| |-- index.html
|-- design/
| |-- images.jpg
可以做到吗?然后将更改推送到Gitlab有什么影响吗?
Can this be done? Are there implications with then pushing the changes up to Gitlab?
答
- 在存储库中创建一个
www
目录. -
git mv
到该目录的HTML文件. (可选)执行此步骤. -
mv
设计目录进入您的仓库,然后git add .
- 提交.
- 重命名/移动您的整个仓库.
- Create a
www
directory in your repo. -
git mv
the HTML files to that directory. Optionally commit this step. -
mv
the design directory into your repo, andgit add .
- Commit.
- Rename/move your whole repo.