问题描述
我想以某种方式改变git目录结构。目前这种架构就像
我有一个解决方案来归档当前的回购,然后创建具有上述结构的新回购。但这种方法的坏处在于它删除了以前的所有历史记录。有没有更好的解决方案?
mkdir VL
git mv<您的所有代码> VL
git commit -m将我的所有代码移动到VL下
使用你告诉git你移动了东西,所以它仍然可以追踪历史记录。
编辑:
正如Benjol在他的评论中指出的那样,使用 git mv 并不是必需的。您可以通过将<所有代码> 复制到 VL 来实现,然后执行
git足够聪明地识别该移动。
I want to somehow change the git directory structure. Currently the architecture is like
I had a solution to archive the current repo and then create the new repo with above structure. But the bad thing about this approach is that it removes all previous history. is there any better solution?
Changing the name of the root folder from VL to html shall be no problem since git only works on the directories below that level.
So, what's left is introducing the folder VL below the html folder and move all code files there:
mkdir VL git mv <all your code> VL git commit -m "moved all my code under VL"
Using git mv you tell git that you moved things, so it could still keep track of the history.
Edit:
As Benjol notes in his comment, using git mv is not neccessary. You could achieve the same by copying <all your code> to VL, then do
- git add VL
- git rm <all your code>
- git commit -m "moved all my code under VL
git is smart enough to recognize the movement.
这篇关于改变git结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!