更新旧的 Git 存储库以从 Subversion 进行同步。

huangapple go评论48阅读模式
英文:

Update old git repo from Subversion

问题

我开始使用gSOAP,并在Github上找到了源代码的git版本。但事实证明,这个仓库已经有10年没有更新了。由于它是Google上“gsoap源代码”的首要搜索结果,我想要更新它,但我不知道它最初是如何创建的。是否可以使用git svn来更新它?

英文:

I started working with gSOAP and found a git version of the source code in Github. But it turned out this repo hasn't been updated for 10 years. Since it's the top entry for "gsoap source code" in Google I wanted to update it, but I have no idea how it was originally created. Is it possible to update it using git svn?

答案1

得分: 0

  1. https://stackoverflow.com/a/38706530/264822 上获取了一些想法,但不得不多次尝试才能使其正常工作。
  2. 在 Github 中分叉该存储库。
  3. 从 Github 克隆我的存储库副本。
  4. 使用 git checkout -b github 创建主分支的副本。
  5. 使用 git branch -d master 删除主分支。
  6. 编辑 .git/config 以添加官方Subversion URL
    [svn-remote "master"]
       url = https://svn.code.sf.net/p/gsoap2/code/
       fetch = :refs/heads/master
  1. 使用 git svn fetch master 将Subversion历史迁移到主分支。
  2. 使用 git checkout master
  3. 使用 git rebase github 将原始Github历史重建到Subversion历史之上。
  4. 使用 git branch -d github 进行清理。
  5. 使用 git push --set-upstream origin master 强制推送新历史。
  6. 从我的更新后的存储库创建一个PR,返回到原始的Github存储库。

可能有更简单的方法来完成这个操作(例如,将Subversion历史拉入一个分支),但这种方法有效。

英文:

I got some ideas from https://stackoverflow.com/a/38706530/264822 but had to play around with it a few times to get this to work.

  1. Fork the repo in Github.
  2. git clone my copy of the repo from Github.
  3. git checkout -b github to make a copy of master.
  4. git branch -d master to delete master.
  5. Edit .git/config to add the official Subversion URL:
    [svn-remote "master"]
       url = https://svn.code.sf.net/p/gsoap2/code/
       fetch = :refs/heads/master
  1. git svn fetch master to migrate the Subversion history into master.
  2. git checkout master
  3. git rebase github to rebase the original Github history onto the Subversion history.
  4. git branch -d github clean up.
  5. git push --set-upstream origin master force push the new history.
  6. Create a PR from my updated repo back to the original Github repo.

There may be a simpler way of doing this (e.g. pulling the Subversion history into a branch) but this method works.

huangapple
  • 本文由 发表于 2023年6月19日 08:25:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76502989.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定