Git 与 Mercurial 的桥梁
我主要使用 Git,并且在 github 上有很多代码。我也希望将其放在 Bitbucket 上,供使用 Mercurial 的人使用,但更重要的是,因为我也希望将代码放在我的 domian 上,并且 BItbucket 支持托管代码的 Cname。
那么有没有一种方法可以让我主要使用 Git,同时也能够推送到 HG。
Github 在其他方向创建了一个项目(对于 HG 存储库到 git),但是有一个适合我正在寻找的方向吗?
I work mostly with Git and have a lot of code on github. I would also like to have it on Bitbucket, for people using mercurial but more importantly as I want to also have the code on my domian, and BItbucket supports Cnames for hosted code.
So is there a way for me to mostly work with Git, but also be able to push to HG.
Github created a project in other direction, (For HG repos to git), but is there one for the direction I am looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我本来打算将其添加到我的其他答案中,但它有点长,所以我们将其作为单独的答案。
如果您想双向使用,可以使用 hg-git 获取
hg您计算机上的存储库版本。您仍然可以在 Git 中完成所有工作,这只是意味着您将使用 GitHub 作为您的中介。
然而,它确实有一个好处,如果您想从 Mercurial 用户那里提取更改,您可以将它们拉入
hg
存储库,然后将它们推送到 GitHub。I was going to add this to my other answer, but it got a little long, so we'll do it as a separate answer.
If you want to go both ways, you can use hg-git to get an
hg
version of the repo on your machine. You can still do all of your work in Git, it just means you'll be using GitHub as your intermediary.However, it does have the benefit that if you want to pull changes from a Mercurial user, you can pull them into the
hg
repo, and push them out to GitHub.如果您只是做 Git 存储库的镜像,那么您可以设置一个 cron 作业来运行以下脚本:
这假设您安装了 SSH 密钥。正如您所看到的,它也会镜像其他 VCS。它假定这样的目录结构:
显然,这只是单向的,但如果您在 Git 中完成所有工作,那么这并不重要。
If you're just doing a mirror of the Git repo(s), then you can set up a cron job to run the following script:
This assumes you have an SSH key installed. As you can see, it will mirror other VCSs as well. It assumes a directory structure like this:
Obviously, this is only one-way, but if you do all of your work in Git, then it won't matter.