如何将现有的非空目录转换为位于另一个目录中的现有非空 git 存储库的 git 分支
我有两个目录,A & B,其内容差异很小。 A 已经被初始化到 git 存储库中,并且对其主分支有许多本地提交。目录 B 不在 SCM 下,它基本上只是从 A 手动复制所有文件(没有 .git 目录)、编辑其中一些文件并添加一些新文件的结果。现在我想将 B 的内容作为 A 中存储库的分支,并且如果可能的话,仍然在目录 B 中托管新分支的开发...但我不知道如何实现这一点,因为我是一个完全 git n00b ,并且还不太了解其 SCM 方法,无法在文档中自行找到答案。有什么提示/指示吗?提前致谢!
I have two directories, A & B, which differ very little in their content. A is already init'd into a git repo and has a number of local commits to its master branch. Directory B is not under SCM and it's basically just the result of manually copying all the files over from A (sans the .git directory), editing some of them, and adding some new ones. Now I want to make the contents of B a branch of the repo in A and, if possible, still host development of the new branch in directory B... but I have no idea how to accomplish that as I am a total git n00b, and don't quite yet understand its approach to SCM enough to find the answer on my own in the documentation. Any tips/pointers? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 A/.git 复制到 B/.git。然后执行通常对分支执行的操作。
然后,您可以像这样同步更改:
或反之亦然。
copy A/.git into B/.git. Then do what you normally would do for the branching.
You can then sync changes like this:
or the other way around.