为什么 git-svn clone 设置“master”?到随机分支?

发布于 2024-10-03 18:18:54 字数 760 浏览 3 评论 0原文

我正在尝试将现有的 svn 存储库移至 git。我们不需要在两者之间进行任何同步(因此没有 git svn fetches 或 dcommits)——我们只是移过去,仅此而已。

我发出这个命令来创建 git 存储库:

git svn clone -s https://server/repos/my_repo

这运行得很好。但是,当我cd进入新的my_repo目录时,其中的文件是其中一个分支(而不是主干)的一部分。

执行 git Branch -a 会产生:

* master
  modelExperimentalTrunk
  modelExperimentalTrunk@719
  dRefactoring
  reorganise
  stableV396
  tags/v1.0
  trunk

我位于 master 分支,但沙箱中的文件实际上来自 dRefactoring 分支(我们比较模糊的分支之一) )。

问题:

  • 为什么master分支没有连接到trunk
  • 有没有办法将其重新连接到trunk?或者可以在 git svn clone 阶段完成吗?
  • 另外,考虑到这将在服务器上,有什么方法 git svn 可以创建 --bare 存储库吗?

I'm trying to move our existing svn repository to git. We don't need to do any syncing between the two (so no git svn fetches or dcommits) -- we're just moving over and that's it.

I issued this command to create the git repository:

git svn clone -s https://server/repos/my_repo

This ran fine. However, when I cd'd into the new my_repo directory, the files that were in there were part of one of the branches (not the trunk).

Doing a git branches -a yields:

* master
  modelExperimentalTrunk
  modelExperimentalTrunk@719
  dRefactoring
  reorganise
  stableV396
  tags/v1.0
  trunk

I am on the master branch, but the files that are in my sandbox are actually from the dRefactoring branch (one of our more obscure branches).

Questions:

  • Why was the master branch not connected to trunk?
  • Is there a way to reconnect it to trunk? Or can that be done during the git svn clone stage?
  • Also, given that this is going to be on a server, is there any way git svn can create a --bare repository?

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

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

发布评论

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

评论(1

凶凌 2024-10-10 18:18:54

将主分支重新连接到主干很容易,只需运行:

git checkout master
git reset --hard trunk

这会切换到主分支(如果还不是这种情况)并将其和工作树重置为主干分支的状态。之后您可以安全地删除主干分支。

git-svn 不支持开箱即用的裸存储库。请阅读 http://gsocblog.jsharpe.net/archives/12 了解更多详细信息。但我认为您不需要这个复杂的解决方案,因为您只想对 SVN 存储库进行一次导入。

因此,您只需创建现有 git 存储库的裸克隆即可。

Reconnecting the master branch to trunk is easy, just run:

git checkout master
git reset --hard trunk

This switches to master branch (if this is not already the case) and resets it and the working tree to state of the trunk branch. After this you can safely delete the trunk branch.

git-svn doesn't support bare repositories out of the box. Read http://gsocblog.jsharpe.net/archives/12 for more details. But I don't think that you need this complicated solution as you just want to do a single import of your SVN repository.

Therefore you can just create a bare clone of your already existing git repository and you're set.

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