改变git结构 [英] changing the git structure

查看:164
本文介绍了改变git结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以某种方式改变git目录结构。目前这种架构就像


  VL(回购)
.git(隐藏)
代码文件
......
.....

我希望它像

html(回购)
.git
VL
代码文件
......
......


我有一个解决方案来归档当前的回购,然后创建具有上述结构的新回购。但这种方法的坏处在于它删除了以前的所有历史记录。有没有更好的解决方案?

解决方案 更改根文件夹的名称 VL






















$ b $ <剩下的就是在 html 文件夹下面引入文件夹 VL 并移动所有代码文件 code> there:

  mkdir VL 
git mv<您的所有代码> VL
git commit -m将我的所有代码移动到VL下

使用 git mv 你告诉git你移动了东西,所以它仍然可以追踪历史记录。




编辑:

正如Benjol在他的评论中指出的那样,使用 git mv 并不是必需的。您可以通过将<所有代码> 复制到 VL 来实现,然后执行


  • git add VL

  • git rm< all your code>

  • git commit -m将我的所有代码移动到VL / li>


git足够聪明地识别该移动。


I want to somehow change the git directory structure. Currently the architecture is like

VL(repo)    
    .git (hidden)    
     code files    
     ......    
     .....

I want it like

html(repo)
    .git   
     VL
       code files
       ......
       ......

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结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆