简体   繁体   English

在生产环境中从SVN迁移到Git

[英]Migrating from SVN to Git in a production environment

I have been tasked with migrating from SVN to Git, but I am unsure how to do so with the current setup in place. 我的任务是从SVN迁移到Git,但是我不确定如何使用当前设置进行迁移。 Here is how the SVN repository works at the moment: SVN存储库目前的工作方式如下:

We have a development server and a production server, both of which are connected to a single SVN repository. 我们有一个开发服务器和一个生产服务器,它们都连接到一个SVN存储库。 We make changes locally and save it to the development server. 我们在本地进行更改并将其保存到开发服务器。 Whenever we are satisfied with these changes, we commit them to the svn repository from the development server (svn commit...), then update them on the production server (svn update...) 只要对这些更改感到满意,我们就会将它们从开发服务器提交到svn存储库(svn commit ...),然后在生产服务器上对其进行更新(svn update ...)

We now want to use Git, but I am unsure how to reflect the same or similar behaviour. 现在,我们要使用Git,但是我不确定如何反映相同或相似的行为。 I initially thought of having a single Git repository with two branches (dev and master). 最初,我想到一个具有两个分支(dev和master)的Git仓库。 The only thing is, both the development and production servers are not in sync; 唯一的问题是,开发服务器和生产服务器都不同步; there are a lot of files with changes on them on the development server and vice versa. 开发服务器上有很多文件有更改,反之亦然。 How best can I approach this dilemma? 我如何最好地解决这个难题?

Edit: I see this far too often. 编辑:我经常看到这种情况。 Please specify a reason for downvoting so I can improve my answer. 请指定拒绝的原因,以便我改善答案。

Git and SVN are both version control systems, but they don't work in exactly the same way. Git和SVN都是版本控制系统,但是它们的工作方式并不完全相同。 They have different workflows. 他们有不同的工作流程。

Git is a distributed version control system, see https://en.wikipedia.org/wiki/Distributed_version_control Git是一个分布式版本控制系统,请参阅https://en.wikipedia.org/wiki/Distributed_version_control

I would suggest starting with a single shared Git repository with a single branch, and a local repository on each developer's workstation. 我建议从一个具有单个分支的共享Git存储库开始,并在每个开发人员的工作站上一个本地存储库开始。 Create the developers' repositories by cloning the shared repo. 通过克隆共享存储库来创建开发人员的存储库。 Then you have to get used to adding an additional step into your workflow: on SVN you used to just 'commit', on Git you will have to 'commit' and then also 'push' to the shared repository. 然后,您必须习惯于在工作流程中添加一个额外的步骤:在以前只是“提交”的SVN上,在Git上,您必须“提交”,然后还“推送”到共享存储库。

Then read the Git from SVN page here: https://git-scm.com/course/svn.html This will help you understand Git from an SVN perspective. 然后在此处阅读SVN上的Git页面: https : //git-scm.com/course/svn.html这将帮助您从SVN角度理解Git。

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

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