如何从现有存储库中创建新的GIT存储库,仅选择存储库中的特定文件夹?
假设我有一个带有三个文件夹A,B和C的GIT存储库。我想创建一个使用仅文件夹C(没有A,B)的新Git存储库,但保留了历史记录。基本上,我想要一个带有文件夹A,B删除的新git回购,并从历史记录中删除了其中的更改;一个只有文件夹C的存储库和更改文件夹内容的内容的提交。
Let's say I have a git repository with three folders A, B, and C. I want to create a new git repository with just folder C ( without A, B ) but with the history preserved. Basically, I want a new git repo with folders A,B deleted and changes in them removed from the history too; a repo with just folder C and the commits which changed the contents of folder C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设当前的存储库
foo
结构是使其
以任何一种方式使
当前的分支重写,并且只保留了触摸C的提交(Commor SHA1值更改)。
将新分支推到新存储库。
Suppose the current repository
foo
structure isTo make it be
To make it be
In either way, the current branch is rewritten and only the commits that have touched C are preserved (the commit sha1 values are changed).
Push the new branch to the new repository.