简体   繁体   English

是否可以让本地Git分支与远程SVN存储库一起工作?

[英]Is it possible to have local Git branches working with remote SVN repositories?

We have a SVN repository with our source code. 我们有一个带有源代码的SVN存储库。 We really want to use local Git branches to develop new features and take advantage of Git capabilities like the merging algorithms. 我们真的想使用本地Git分支来开发新功能并利用Git功能,如合并算法。

Is that possible? 那可能吗? If yes, could someone provide some information about how to perform that? 如果是,有人可以提供一些有关如何执行此操作的信息吗?

Yes. 是。 You will need to use git-svn . 你需要使用git-svn

First you will need to git svn clone your SVN repository. 首先,您需要git svn clone您的SVN存储库。 Note that this will fetch every revision from the SVN server, and recreate the history as a Git repository. 请注意,这将从SVN服务器获取每个修订 ,并将历史记录重新创建为Git存储库。 These Git repositories should not be shared by multiple developers. 多个开发人员不应共享这些Git存储库。 Each developer should run git svn clone individually! 每个开发人员都应该单独运行git svn clone

Then you can create local branches all you want using standard Git commands, since you basically have a standard Git repository with some extra SVN metadata for tracking SVN commits. 然后,您可以使用标准Git命令创建所有您想要的本地分支,因为您基本上有一个标准的Git存储库,其中包含一些用于跟踪SVN提交的额外SVN元数据。 You can use commands like git svn dcommit to push commits in Git to the SVN server (each Git commit would become a separate SVN commit). 您可以使用git svn dcommit类的命令将Git中的提交推送到SVN服务器(每个Git提交将成为单独的SVN提交)。

I would consider reading a good git-svn tutorial . 我会考虑阅读一个很好的git-svn教程

(If possible, you might also consider whether you would actually rather use git-svn to convert your SVN repository to a Git repository, and then discontinue use of SVN altogether.) (如果可能的话,您可能还会考虑是否真的宁愿使用git-svn将SVN存储库转换为Git存储库,然后完全停止使用SVN。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM