gpt4 book ai didi

git - 如何共享 git svn 配置?

转载 作者:太空狗 更新时间:2023-10-29 14:14:41 24 4
gpt4 key购买 nike

所以我建立了一个 git-svn 仓库并将它推送到 github。但是,如果有人克隆它,则克隆中没有 svn 配置。
我推送的存储库与我在推送后从 github 克隆的存储库之间的差异是:

enter image description here

我推送的那个(带有 svn 信息的 svn 克隆)在右边 - 来自 github 的克隆在左边
我应该分享哪些(文件夹/文件(或配置部分))让人们像我一样设置 git-svn?从某种意义上说,他们克隆然后复制粘贴这些文件(并且可能运行 git svn rebase),并且他们具有与我相同的设置。我也将 svn repo 的所有分支和标签克隆为远程分支,我也想分享这些。理想情况下,即使在我(我们)开始在 git 和 svn 存储库之间推送/提交之后,这些文件仍然有效

最佳答案

这似乎对我有用:

git clone your-existing-git-repo new-cloned-repo
cd new-cloned-repo
git fetch origin refs/remotes/*:refs/remotes/*
git init
git svn init -s "svn://your-svn-server/your-svn-repo/your-svn-project"
git svn fetch
git checkout master
git svn rebase

虽然上面的工作正常,但我发现下面使用 .git/config 文件创建了一个与我的原始文件相同的 repo(没有 origin 远程附件 master 分支)。

mkdir new-cloned-repo
cd new-cloned-repo
git init --bare .git
git remote add backup your-existing-git-repo
git fetch backup refs/remotes/*:refs/remotes/*
git fetch backup refs/heads/*:refs/heads/*
git fetch backup refs/tags/*:refs/tags/*
git init

# update SVN references
git svn init -s "svn://your-svn-server/your-svn-repo/your-svn-project"
git config svn.authorsfile your-authors-file.txt
git svn fetch

git checkout master
git svn rebase
git svn show-ignore >> .git/info/exclude

这应该克隆所有 Git 提交 git clone/git fetch 和远程分支(所有 SVN 分支/你现有的 repo 知道的标签)git fetch origin refs/remotes/*,更新 SVN 连接信息 git svn init,然后通过 git svn fetch 将 SVN 修订更新到 Git 提交映射。

git svn init -s 假定您在 your-svn-project 下以正常的 SVN 方式存储内容(trunkbranches/*, tags/*).

我不确定是否需要 git init,但我确信如果不需要它也不会造成任何损害。此外,git checkout master 可能是多余的,但无害。

关于git - 如何共享 git svn 配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18006273/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com