如何在同一源代码树中使用 GIT-TFS 和 GIT-SVN?

发布于 2024-10-30 05:07:06 字数 839 浏览 3 评论 0 原文

我正在工作一个项目,我想通过使用 git 进行本地源代码控制来使其变得不必要的复杂变得更加容易。我们在工作中使用 TFS,但我还必须将源代码推送到客户端的 SVN 服务器以进行生产发布。 TFS 需要成为官方记录源 [直到我能够提出令人信服的案例来切换:-)],SVN 只是里程碑,我希望 git 成为日常工作环境。

我一直在使用 git-svn 作为第二部分,基本上只是致力于 git at里程碑,然后推送到 svn。

我也想转而使用 git 而不是 TFS 来进行更积极的开发,但我不确定如何/是否可以同时设置这两个映射。我看到的 git-tfs 和 git-svn 的所有示例都是从克隆存储库开始的,这要求存储库为空。是否可以添加某种元数据而不是克隆来设置 TFS 映射?

映射也有点奇怪(这是一个 CMS 站点,所以我们不在源代码管理中存储核心文件,只存储我们的自定义文件):

  • 标签(仅由 SVN 使用)
  • 分支(来自 SVN,未使用)
  • 主干(来自 SVN ) ,符号链接到网站)
  • 网站
    • 桌面模块(在 TFS 中映射)
    • 门户(在 TFS 中映射)
    • 提供商(在 TFS 中映射)

git 是否能够处理根映射的 SVN 存储库和进一步映射的 TFS 存储库?

是否可以删除 TFS 中映射的文件夹,然后从 git-tfs 克隆它们?

I have a project at work that I'd like to make needlessly complexeasier by using git for my local source control. We use TFS at work, but I also have to push the source to the client's SVN server for production releases. TFS needs to be the official source of record [until I can make a convincing case to switch :-)], SVN is just milestones, and I'd love for git to be the day-to-day working environment.

I've been using git-svn for the second part, basically just committing to git at the milestones, then pushing to svn.

I'd like to move to using git instead of TFS for the more active development, too, but I'm not sure how/if I can have both mappings setup at the same time. All of the examples that I see for git-tfs and git-svn start with cloning the repository, which requires the repository to be empty. Is there some sort of metadata that I can add instead of cloning to setup the TFS mapping?

The mappings are also a little weird (it's a CMS site, so we don't store the core files in source control, only our customizations):

  • tags (only used by SVN)
  • branches (from SVN, not used)
  • trunk (from SVN, symlinked to Website)
  • Website
    • DesktopModules (mapped in TFS)
    • Portals (mapped in TFS)
    • Providers (mapped in TFS)

Will git be able to handle the SVN repository mapped at the root and the TFS repository mapped further in?

Would it work to delete the folders mapped in TFS, then clone them from git-tfs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

口干舌燥 2024-11-06 05:07:06

您可以通过将适当的节添加到 .git/config 来将 git-svn 移植到任何存储库(检查任何工作的 git-svn 存储库以查看它看起来像什么),然后用 git-svn fetch 来填充它。 git-svngit-tfs 不太可能为相同的树生成​​相同的 SHA(例如,由于诸如用户名映射或日期之类的琐碎事情,或者像元数据 git-svn 默认情况下会放入提交消息),但合并应该很简单。您可以使用 svn.noMetadata 禁用每个提交中将 SVN 修订版映射到 git 提交的额外行。唯一的缺点是 rev_map 将是该信息的唯一来源,如果它被删除(或者克隆工作副本),git-svn 连接将被破坏。

You can graft git-svn onto any repository by adding the appropriate stanza to .git/config (examine any working git-svn repo to see what it looks like) followed by git-svn fetch to populate it. It's unlikely that both git-svn and git-tfs will produce identical SHAs for identical trees (eg due to trivial things like username mapping or dates, or less trivial things like the metadata git-svn puts in commit messages by default) but the merges should be trivial. You can use svn.noMetadata to disable the extra line in each commit that maps the SVN revision to the git commit. The only downside to that is that the rev_map will be the only source of that information and if it is deleted (or if you clone your working copy) the git-svn connection will be broken.

新一帅帅 2024-11-06 05:07:06

我认为目前还不能。当您提交到 tfs 时 - git-tfs 有效地使用相同的树和更改的注释重写您对新提交的提交(附加类似 git-tfs-id: [http://tfs:8080/tfs]$/ Project;C666 到原始评论的末尾)。

关于将 comment altering 替换为 想法 href="http://progit.org/2010/08/25/notes.html" rel="nofollow">git 注释。但目前它甚至不在计划中。

I think that currently you can't. When you commit to tfs - git-tfs effectively rewrites your commit to the new one with the same tree and altered comment (appends something like git-tfs-id: [http://tfs:8080/tfs]$/Project;C666 to the end of original comments).

There were some thoughts about replacing comment altering with git notes. But it is not even in plans currently.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文