且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

同一个 svn 存储库的不同 git-svn 克隆能否期望能够共享更改然后 git svn dcommit?

更新时间:2023-01-22 10:49:19

问题当然是第 4 步.dcommit 尝试将您的本地历史记录重播到服务器.Dcommit 假装您是 SVN 客户端.现在,如果您提交的代码不仅来自您,那么很难将其提交给 SVN.

The problem is step 4 of course. A dcommit tries to replay your local history to the server. Dcommit pretends that you're a SVN client. Now, if the code you're dcommitting isn't only from you, that's something that is hard to dcommit to SVN.

以下是 guru 对此事的描述:

Here's what the guru writes on the matter:

  • 为了简单和与 SVN 的互操作,它是推荐所有 git-svn 用户直接从SVN 服务器(远程 SVN存储库即),并避免所有git-clone/pull/merge/push 操作在 git 存储库和分支之间要么通过 git svn 检索克隆,也用于推送将变更集返回到远程 SVN存储库.
  • git 分支之间交换代码的推荐方法用户是 git format-patch 和 gitam,或者只是 git svn dcommit 到 SVN存储库.
  • 由于 git svn dcommit 在内部使用 git svn rebase,因此我们可以使用任何 git 分支git push to before git svn dcommit on他们将需要强制覆盖遥控器上的现有参考存储库.这一般是被认为是不好的做法,请参阅有关详细信息,请参阅 git-push 文档.
  • 不建议在我们计划的分支上运行 git merge 或 git pullgit svn dcommit 来自.SVN 没有代表以任何合理或有用的时尚让用户使用 SVN看不到我们所做的任何合并.此外,如果我们 git merge 或 git从 git 分支中拉取SVN 分支的镜像,git svndcommit 可能会犯错分行.
  • git clone 不会克隆 refs/remotes/层次结构下的分支或任何 git-svn 元数据或配置.所以创建和管理的存储库使用 git-svn 应该使用 rsync用于克隆,如果要进行克隆
  • 我们不应该在我们所做的更改上使用 git commit 的 --amend 选项已经dcommitted.它是认为不好的做法 --amend提交我们已经推送到其他用户的远程存储库,以及dcommit with SVN 与此类似.可以找到有关此的更多信息在修改单个提交和重写历史记录的问题.
  • For the sake of simplicity and interoperating with SVN, it is recommended that all git-svn users clone, fetch and dcommit directly from the SVN server (the remote SVN repository that is), and avoid all git-clone/pull/merge/push operations between git repositories and branches which are either retrieved via git svn clone and which are also used to push back changesets into the remote SVN repository.
  • The recommended method of exchanging code between git branches and users is git format-patch and git am, or just git svn dcommit to the SVN repository.
  • Since git svn dcommit uses git svn rebase internally, any git branches we git push to before git svn dcommit on them will require forcing an overwrite of the existing ref on the remote repository. This is generally considered bad practice, see the git-push documentation for details.
  • Running git merge or git pull is not recommended on a branch we plan to git svn dcommit from. SVN does not represent merges in any reasonable or useful fashion so users using SVN cannot see any merges we have made. Furthermore, if we git merge or git pull from a git branch that is a mirror of an SVN branch, git svn dcommit may commit to the wrong branch.
  • git clone does not clone branches under the refs/remotes/ hierarchy or any git-svn metadata, or config. So repositories created and managed with using git-svn should use rsync for cloning, if cloning is to be done at all.
  • We should not use the --amend option of git commit on a change we have already dcommitted. It is considered bad practice to --amend commits we have already pushed to a remote repository for other users, and dcommit with SVN is analogous to that. More information on this can be found at Modifying a single commit and Problems with rewriting history.