Git - 重写历史并将文件夹视为分支
我有一个 Git 存储库,代表从 git-tfs 拉入的源存储库。
TFS 具有将分支作为完整副本存储在文件夹中的约定。我想遍历 TFS 的 git 副本的历史记录,将针对特定文件夹的提交视为针对特定分支的提交。
例如,存储库看起来像
Main (TFS concept of trunk / master / default)
Branch1
Branch2
Branch3
Folder/Branch4
为了让事情变得更复杂一些,其中一些分支在某个时间点被重命名。
因此 Branch1 可能曾经是 B1。
我也必须适应这种情况。
当然,还存在从一个分支到另一个分支的合并。
我不确定这是否可以做到,但我有兴趣看看是否有人有任何建议。我看过 git-filter-branch,但我不确定最终结果是否正是我想要的。因此,虽然我可以继续实验,直到得到某种正确的东西,但我想我会问是否有人以前做过这个;0
I have a Git repository representing a source repository pulled in from git-tfs.
TFS has the convention of storing branches as full copies in folders. I'd like to run through the history of the git copy from TFS, treating commits against specific folders instead as commits against specific branches.
For instance, the repository looks something like
Main (TFS concept of trunk / master / default)
Branch1
Branch2
Branch3
Folder/Branch4
To make this a little more complicated, some of these branches were renamed at some point in time.
So Branch1 could have at one point been B1.
I'll have to accommodate this scenario as well.
And of course, there were merges from one branch to another.
I'm not sure if this can even be done, but I'm interested to see if anyone has any suggestions. I've looked at git-filter-branch, but I'm not sure the end result would be what I'm looking for exactly. So while I could keep experimenting until I get something kinda-sorta right, I figured I'd ask if anyone has done this before ;0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前没有这样做过,但这样的转换可能涉及:
git filter-branch
,如这个SO问题所示)grafts
点和filter-branch
将这些分支历史集合为一个(您获得多个根)I haven't done it before, but such a transformation might involve:
git log --name-ony aBranchName
: to do for each branch, in order to get all unique name those branches got during the course of the full history of the repogit filter-branch
, as shown in this SO question)grafts
points andfilter-branch
: see "Convert multiple hg repositories to single git repository with multiple branches" for the general idea.