[英]Is it worth going to Git from SVN for a single developer?
--- THIS THREAD IS VERY LIKELY OUTDATED AS OF 2013 --- ---这条线在2013年非常糟糕---
Is it worth going to GIT from SVN when the repositories are mainly accessed by a single developer? 当存储库主要由单个开发人员访问时,是否值得从SVN转到GIT? I have several machines that I use for development and not mainly develop in C#. 我有几台机器用于开发,而不是主要用C#开发。 But I have a mix of VB, VB.Net, PHP, C#, C++, HTML, Batch, BASH and many more in my repositories. 但我在我的存储库中混合使用VB,VB.Net,PHP,C#,C ++,HTML,Batch,BASH等等。 What, if anything, will I gain by migrating to GIT from SVN? 通过从SVN迁移到GIT,我将获得什么? Right now use TortoiseSVN + VisualSVN Server with a set of central repositories and several client machines. 现在使用TortoiseSVN + VisualSVN Server与一组中央存储库和几个客户端机器。 While I have granted a few friends access to my repositories they do not Update or Commit often (if ever). 虽然我已授予一些朋友访问我的存储库的权限,但他们并不经常更新或提交(如果有的话)。
Also is there a way to have the flexibility and ease of maintenance I get with VisualSVN Server + TortiseSVN with Git? 还有一种方法可以使用VisualSVN Server + TortiseSVN和Git获得灵活性和易维护性吗?
((I'll bite... what other platforms and trickery would be compelling for a single developer/small group?) ((我会咬一口......对于一个开发者/小组来说,其他平台和技巧会引人注目吗?)
Please List Pros and Cons not just one sided opinions. 请列出优点和缺点,而不仅仅是单方面的意见。
Current Tool Chain... Visual Studio 2008 (C#/VB.Net) + TortoiseSVN + VisualSVN 当前工具链... Visual Studio 2008(C#/ VB.Net)+ TortoiseSVN + VisualSVN
Main Focus... XNA Games, WCF/Socket Services, Web Development 主要焦点... XNA游戏,WCF /套接字服务,Web开发
I can give you three advantages: 我可以给你三个好处:
There is a disadvantage; 有一个缺点; and that is that the visualisation tools available on Windows are not as user friendly as those that are, perhaps, available for other platforms. 这就是Windows上可用的可视化工具不像那些可能用于其他平台的用户友好。
Yes, of course. 当然是。
You're misunderstanding what git is. 你误解了git是什么。 I mean, why would you assume it's only useful for teams? 我的意思是,你为什么认为它只对团队有用?
git is even more worth it if you're a single developer. 如果你是一个开发人员,git更值得。
grep
or ls
or any other simple command line utility. 另一方面,git是一个简单的实用程序,只需运行它就像运行grep
或ls
或任何其他简单的命令行实用程序一样。 You don't need to setup any server or anything like that. 您不需要设置任何服务器或类似的东西。 winmergeu <conflictfile>
on every conflict file, to resolve conflicts. 我个人使用WinMerge,并在每个冲突文件上调用命令winmergeu <conflictfile>
来解决冲突。 (Note: WinMerge is not a command-line merge tool, it's a visual merge tool, with a normal gui). (注意:WinMerge不是命令行合并工具,它是一个可视化的合并工具,具有正常的gui)。 I didn't notice the bit about you working from several different machines. 我没注意到你在几台不同的机器上工作。
It doesn't make a difference, you just have to remember to push and pull whenever you switch to a different machine, but you already do this with svn: commit/update. 它没有什么区别,只要你切换到另一台机器就必须记住推拉,但你已经用svn:commit / update做了这个。
You'll get the power of branching/merging. 你将获得分支/合并的力量。 Don't under-estimate this power. 不要低估这种力量。
How many times have you thought of implementing some crazy idea, but never dared to do it because you don't want to mess up your code? 你有多少次想过实现一些疯狂的想法,但从来不敢这么做因为你不想弄乱你的代码? git relieves you from these worries. git让你免于这些烦恼。 Just do it in a branch, if it works out, merge it to the main branch, if it didn't, delete the branch and forget about it. 只是在分支中执行它,如果它运行,将它合并到主分支,如果没有,删除分支并忘记它。
Sure, you might say that you can do the same with svn revert
, reverting back to the revision before you started the crazy idea. 当然,你可能会说你可以用svn revert
做同样的事情,在你开始疯狂的想法之前恢复到修订版。 but what if you had bug fixes applied in the meantime? 但是,如果你同时修复了错误修复怎么办? If you revert your crazy idea, you'll lose all the bug fixes/maintenance work you did while experimenting with your crazy idea. 如果你恢复了疯狂的想法,你将失去在尝试疯狂想法时所做的所有错误修复/维护工作。
Apart from what has already been said, If you're a single developer and haven't experienced troubles with SVN I see no reason to switch. 除了已经说过的话,如果你是一个单一的开发人员并且没有遇到过SVN的麻烦,我认为没有理由转换。 svnserve (the daemon) works fine locally (I have OS X). svnserve(守护进程)在本地工作正常(我有OS X)。
TortoiseSVN is a blessing compared to Git tools… is there any particular reason why you'd like to move away from Subversion? 与Git工具相比,TortoiseSVN是一种祝福......你有什么特别的理由想要摆脱Subversion吗?
It really depends on your workflow. 这实际上取决于您的工作流程。 Do you work often from places where you cannot reach your svn server? 你经常在无法到达svn服务器的地方工作吗? Do your projects have a large number of branches because you like working on several (big) things at the same time? 你的项目是否有大量的分支,因为你喜欢同时处理几个(大)的事情? Do you copy working copies between machines? 你在机器之间复制工作副本吗? Do you split off new branches from an existing branch? 你是否从现有的分支机构中拆分了新的分支机构? Do you sometimes work on the trunk and halfway through a bunch of changes think "I should have done this in a branch"? 你有时在后备箱上工作,在一堆变化的中途想到“我应该在一个分支中做到这一点”吗? If so, then it may be useful. 如果是这样,那么它可能是有用的。
From a single developer's point of view, the main difference between a central system like svn and a decentral system like git is that in svn the revisions are linear. 从单一开发人员的角度来看,像svn这样的中央系统和像git这样的分散系统之间的主要区别在于,在svn中,修订是线性的。 With git it's a tree. 用git它是一棵树。 This is useful when you work on bigger features that you want to do in multiple commits. 当您处理要在多次提交中执行的更大功能时,这非常有用。
Example: You have a big feature F that consists of changes a, b, c and d. 示例:您有一个很大的功能F,它包含更改a,b,c和d。 With Subversion you'd either commit a, b, c and d separately on the trunk, or you'd create a branch which means you have to do a lot of merging. 使用Subversion,您可以在主干上单独提交a,b,c和d,或者您创建一个分支,这意味着您必须进行大量合并。 With git you check out a working copy, commit a, b, c, and d on it. 使用git,您可以查看工作副本,提交a,b,c和d。 Then you'd push that as a single change F to your master. 然后你将它作为单个更改F推送给你的主人。 So, instead of four commits you see just one commit on the trunk. 因此,您只需在主干上看到一次提交,而不是四次提交。 This makes it easier to see from the log what is going on. 这样可以更容易地从日志中看到发生了什么。
You could do this with svn branches as well. 您也可以使用svn分支执行此操作。 But now suppose that part a also consists of multiple parts, like a1 and a2. 但现在假设a部分也包含多个部分,如a1和a2。
Such a development model can be done with Subversion. 这种开发模型可以使用Subversion完成。 Python Twisted is done that way for example. 例如,Python Twisted以这种方式完成。 All development is done on branches and nobody works on the trunk. 所有的开发都是在分支上进行的,没有人在主干上工作。 But git makes such a workflow easier. 但是git使这样的工作流更容易。
I have used these systems in the manner which you describe, under Windows with Visual Studio 2008: 我在Windows下使用Visual Studio 2008以您描述的方式使用这些系统:
If you value your life, do not ever use Visual Source Safe... 如果你珍惜你的生命, 永远 不要使用Visual Source Safe中...
One thing that may be compelling about Git is that you can continue to work and do commits offline. 关于Git可能引人注目的一件事是你可以继续工作并做离线提交。 So, when you are on the plane, bring your laptop and commit as usual. 所以,当你在飞机上时,带上你的笔记本电脑并照常提交。 When you are back online, you can push back to your main repo. 当您重新上线时,您可以回到主仓库。
If you find you do a lot of branching you will probably prefer Git, as it is designed around making branching/merging easy and commonplace. 如果你发现你做了很多分支,你可能会更喜欢Git,因为它的设计是为了使分支/合并变得简单和普通。
Update: Note you can test out Git without committing to it, since Git can talk to SVN repos . 更新:注意你可以测试出Git而不需要它,因为Git可以与SVN repos交谈 。 So give it a try, and if you don't like it, nothing lost! 试试吧,如果你不喜欢它,什么都不会丢失!
Just try it, install msysgit , then 试试吧,然后安装msysgit
git svn clone svn://mysvn/repo/
Some of the resources in Git for beginners: The definitive practical guide should be of help ( Gitcasts and Git Magic especially) Git中的一些初学者资源:明确的实用指南应该有所帮助(特别是Gitcasts和Git Magic )
Personally I find git much more pleasant to use in general. 就个人而言,我发现一般来说使用git更加愉快。 I switched my personal SVN repos to git about two years ago and haven't had a single problem with it ever 大约两年前,我将我的个人SVN回购转换为git,并且从来没有遇到任何问题
Not having to worry about your SVN server is nice (no need for constant network access to it), so is being able to trivially create repositories (they're just a folder containing another .git
folder), perform any operations (commit, branching etc etc), then decide to put the code on Github with a simple command or two. 不必担心你的SVN服务器很好(不需要对它进行持续的网络访问),因此能够轻松创建存储库(它们只是一个包含另一个.git
文件夹的文件夹),执行任何操作(提交,分支)等等,然后决定用一两个简单的命令将代码放在Github上。
It's generally much "snappier" (almost every action basically instant), everything works "offline", clones are complete backups.. but the main reason I keep using it is Github 它通常很“快”(几乎所有动作基本上都是即时的),一切都可以“离线”,克隆是完整的备份..但我继续使用它的主要原因是Github
No. At least not for me. 不,至少不适合我。 What's the point of having a non-centralized repo for a single dev? 为单个开发者提供非集中式回购有什么意义?
Also, the Git Windows tools aren't quite up to the TortoiseSVN bar. 此外,Git Windows工具并不完全取决于TortoiseSVN吧。
Some time ago I did that move from svn to Git. 前段时间我从svn转到Git。 I agree with several of the above answers about advantages of Git distributed architecture over svn (like ability to take my repo with me on my notepad), but the compelling reasons were much more mundane. 我同意上面几个关于Git分布式架构优于svn的优点的答案(比如能够在我的记事本上带我的回购),但令人信服的理由更为平凡。
Nowadays (2/2013) there is only a single .svn folder in root folder present! 如今(2013年2月)根文件夹中只有一个.svn文件夹!
I had several bad experience with my svn client on Linux, seemingly simple actions like moving a file and then modifying it before committing caused system hangup using 100% CPU! 我在Linux上的svn客户端遇到了一些不好的经历,看似简单的操作,如移动文件然后在使用100%CPU提交系统挂起之前修改它! (And no, it was not something else that caused the crash and I could repeat it at will). (不,它不是导致崩溃的其他因素,我可以随意重复它)。 Never encountered such problems with Git tools. 从未遇到过Git工具的这些问题。
I also had some terrible times merging code between trunk and stable branch on my old svn repository. 我在旧的svn存储库中的trunk和stable分支之间合并代码也有一些糟糕的时间。 It's really easier with Git. 使用Git真的很容易。
Now, I made that move because I really felt bad using svn, if it works for you there is really no compelling need to change. 现在,我采取了这一举措,因为我真的感觉不好用svn,如果它对你有效,那么真的没有迫切需要改变。 The real task of a programmer is working with code, repositories are just tools that should at least not get in his way. 程序员的真正任务是使用代码,存储库只是至少不会妨碍他的方式的工具。 And that was exactly why svn didn't worked for me. 这就是为什么svn对我不起作用的原因。
Look into Bazaar (bzr). 看看Bazaar(bzr)。 Seriously, it is amazing. 说真的,这太棒了。 Best merge capability I've seen. 我见过的最好的合并能力。
If you are used to Tortoise SVN, then you should try Mercurial, which has a Windows package with a similar shell extension Tortoise HG . 如果你习惯了Tortoise SVN,那么你应该尝试Mercurial,它有一个带有类似shell扩展名Tortoise HG的Windows软件包。 Also Joel Spolsky is using Mercurial at Fog Creek (according to him in one of his podcasts). Joel Spolsky也在Fog Creek使用Mercurial(根据他在他的一个播客中的说法)。
The package is completely stand-alone, I was able to install and use Mercurial right away (doesn't even need a server!) 该软件包是完全独立的,我能够立即安装和使用Mercurial(甚至不需要服务器!)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.