我怎样才能从一个现有的文件树在git中创建一个新的分支? [英] How can I create a new branch in git from an existing file tree?

查看:188
本文介绍了我怎样才能从一个现有的文件树在git中创建一个新的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找添加一个现有的文件树作为一个新的分支(我不能只是将现有的树复制到我的git树,因为现有的树在不同的VCS下版本化,我试图将它们同步)。



这可能吗?



编辑:会设置一个新的git仓库,连接到现有的远程仓库,然后移动生成的.git文件夹工作?这似乎真的很骇人,但如果这是做到这一点的方法......

您可以尝试使用 - work-tree =< path> 选项可以从其他目录添加文件,例如:

  git --work-tree = / path / to / file add。 


I am looking to add an existing file tree to a git repository as a new branch (I can't just copy the existing tree into my git tree, since the existing tree is versioned under a different VCS, and I am trying to sync them up).

Is this possible?

EDIT: Would setting up a new git repository, that is connected to the existing remote repository, and then moving the resulting .git folder work? That seems really hackish, but if that's the way to do it...

解决方案

You can try to use --work-tree=<path> option to git to add files from other directory, e.g.:

git --work-tree=/path/to/file add .

这篇关于我怎样才能从一个现有的文件树在git中创建一个新的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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