我在互联网(各种网站和博客)上阅读了有关版本控制的内容。它有多棒,所有开发人员都需要使用它,因为它非常有用。
问题是:我真的需要这个吗?我是一名前端开发人员(通常只是 HTML/CSS/JavaScript),我从来没有遇到过像“哇,我昨天的文件!”这样的问题。 我尝试过使用它,安装了Subversion和 TortoiseSVN ,我理解版本控制背后的概念,但是......我无法使用它(对我来说很奇怪)。
好吧,那么...这很糟糕吗?我通常独自工作(自由职业者),并且没有客户要求我使用 Subversion(但永远不会太晚,对吧?)。那么,我应该开始努力学习使用 Subversion(或类似的东西吗?)还是只是浪费时间?
<小时 />请您参考如下方法:
下面的场景可以说明源代码管理的有用性,即使您单独工作也是如此。
Your client asks you to implement an ambitious modification to the website. It'll take you a couple of weeks, and involve edits to many pages. You get to work.
You're 50% done with this task when the client calls and tells you to drop what you're doing to make an urgent but more minor change to the site. You're not done with the larger task, so it's not ready to go live, and the client can't wait for the smaller change. But he also wants the minor change to be merged into your work for the larger change.
Maybe you are working on the large task in a separate folder containing a copy of the website. Now you have to figure out how to do the minor change in a way that can be deployed quickly. You work furiously and get it done. The client calls back with further refinement requests. You do this too and deploy it. All is well.
Now you have to merge it into the work in progress for the major change. What did you change for the urgent work? You were working too fast to keep notes. And you can't just diff the two directories easily now that both have changes relative to the baseline you started from.
上述场景表明,即使您单独工作,源代码管理也可以是一个很棒的工具。
- 您可以使用分支来处理长期任务,然后在完成后将分支合并回主线。
- 您可以将整组文件与其他分支或过去的修订版本进行比较,看看有什么不同。
- 您可以跟踪一段时间内的工作情况(顺便说一句,这对于报告和开具发票非常有用)。
- 您可以根据日期或您定义的里程碑恢复任何文件的任何修订。
对于单独工作,建议使用 Subversion 或 Git。任何人都可以自由地选择其中之一,但显然任何一个都比不使用任何版本控制要好。好书是 Mike Mason 的“Pragmatic Version Control using Subversion, 2nd Edition”或 Travis Swicegood 的“Pragmatic Version Control Using Git”。