如果您想要本地 VCS,您可以设置自己的 subversion 服务器(我过去就是这样做的),但今天我建议使用 git。简单多了。只需 cd 到您的代码目录并运行:
git init
欢迎来到俱乐部。
Even if you work alone you can benefit from source control. Among others, for these reasons:
You don't lose anything. I never again commented out code. I simply delete it. It doesn't clutter my screen, and it isn't lost. I can recover it by checking out an old commit.
You can experiment at will. If it doesn't solve the problem, revert it.
You can look at previous versions of the code to find out when and where bugs were introduced. git bisect is great in that regard.
More "advanced" features like branching and merging let you have multiple parallel lines of development. You can work in two simultaneous features without interference and switch back and forth without much hassle.
You can see "what changed". This may sound basic, but that's something I find myself checking a lot. I very often begin my one-man workflow with: what did I do yesterday?
Just go ahead and try it. Start slowly with basic features and learn others as you go. You will soon find that you won't ever want to go back to "the dark ages" of no VCS.
If you want a local VCS you can setup your own subversion server (what I did in the past), but today I would recommend using git. Much simpler. Simply cd to your code directory and run:
Version control is a rare tool that I would say is absolutely required, even if you are only using it as a solo developer. Some people say that it's a tool that you live and die by, I agree with that assertion.
You probably use version control right now, even if you don't know it. Do you have any folders that say "XXX Php Code (December)" or "XXX.php.bak.2"? These are forms of version control already. A good version control system will take care of this for you automatically. You will be able to roll back to any point in time (that you have data checked in) and be able to see an exact copy of that data.
Furthermore, if you adopt a system like subversion, and use a remote repository (such as one on a server you own), you will have a place to keep all of your code. Need a copy of your code somewhere else? No problem, just check it out. Hard drive crash at home? Not an issue (at least with your source code).
Even if you don't use version control now, you will likely use it at one point in time later in your career and you could benefit from becoming more comfortable with the principles now.
Even working alone, has this ever happened? You run your app, and something does not work and you say "that worked yesterday, and I swear I did not touch that class/method." If you are checking in code regularly, a quick version diff would show exactly what had changed in the last day.
Here's a scenario that may illustrate the usefulness of source control even if you work alone.
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.
The above scenario shows that source control can be a great tool, even if you work solo.
You can use branches to work on longer-term tasks and then merge the branch back into the main line when it's done.
You can compare whole sets of files to other branches or to past revisions to see what's different.
You can track work over time (which is great for reporting and invoicing by the way).
You can recover any revision of any file based on date or on a milestone that you defined.
Even as a single developer source control offers a great benefit. It allows you to store your code's history and revert back to previous versions of your software at any time. This allows you fearless flexibility to experiment because you can always restore to another version of your source code that was working.
It's like having a giant "undo" button all the way back to your first line of code.
Version control is almost impossible to live without after you start using it. It is indispensible if more than one developers are working on the same code base...but it also quite useful for a single developer.
It tracks the changes in your code and allows you to roll back to previous versions. It frees you to experiment with the knowledge that if anything breaks you can undo your changes.
You gain security (in the sense of having a back-up of your code) and versioning of your code (assuming you get into a habit of committing your changes often). Both are very good things even if nobody else ends up ever working on the code with you...
Version control is great for checking previous versions, even if you're working alone. For example, if you accidentally delete code or a file you can get it back; or you can compare previous versions to see why a new bug has crept in. It's also good if you're one person working in multiple locations.
There are a number of reasons to use version control, even if you are the only person who will ever touch the code.
Backup - what if your hard-drive crashes? Do you have a copy anywhere?
Revision history - Do you currently keep copies of code in different folders? Version control gives you the ability to track your changes over time and easily diff different revisions, merge, roll back changes, etc. using tools.
Branches - the ability to test out some changes, still track what you are doing, and then decide whether or not you want to keep it and merge into the main project or just throw it away.
If you keep your code under version control, then it makes it really easy to see which files you have changed (or have forgotten to add to the baseline).
Something that no one else seems to have explicitly mentioned is the tagging or labeling of releases. If you have a client using version 1 of your software and you're busy working on version 2 what do you do when the client reports a bug and you need to build version 1.1?
A source control system will let you label every release you make so you can go back to it later, make the fix (and merge that fix into the new version 2 code) and make a new release without worrying that you might accidentally deliver something that isn't ready.
Source control is a core part of modern software development. If you're not using it (even for personal projects as the more experience you have the better) you're doing something wrong.
Usually one of the first questions I ask when being interviewed for a job is "What do you use for source control?" So far only one place has said "Nothing" but they were planning to fix that "Real soon now..."
It is also about backing up old file that why it is called "Subversion". So you can manage multiple version of your work in which you can return back (revert) and manage the different implementation of it (branching).
You may find that you had a working version of your program.
You decide to add a few new features over a period of time and you release that.
You start getting bug reports affecting some code that you thought you didn't touch.
By using SVN, for example, you can move back to an older version, and check to see if the new bug exists. Once you find a version that introduced the bug it will be easier to fix it as you can compare the version that worked to what didn't work and see what changed, then it will narrow down the search.
Source control has many uses, even if you are the only developer.
Sounds like you're looking for something a bit more light-weight. Check out Mercurial (awesome reference book). I use it for everything, from source code to personal correspondence.
Some benefits:
Giant Undo button, so you can return the those halcyon days of last week when the code actually ran
Throw-away code. Not sure if this is the best way to do something? Make a branch and experiment. Nobody but you ever has to know about it if you're using a DVCS like mercurial.
Syncronized development. I develop on 4 different computers. I push and pull between them to keep the current, so no matter which one I'm at I've got the newest versions.
Even if you haven't been in a situation yet where you needed an older version of your program, having a source control gives you greater confidence to make major changes.
I found myself doing more aggressive refactoring after using source control because I always knew that a working version could be easily restored.
I have also only recently begun to get interested in version control. In version control systems, you have the concept of a repository for your code. A wealth of new shell commands get learned very quickly so that you can interact with this repository.
Once you save your code to a file, you can then commit this to your project's repository. As you develop your code and commit your changes the repository develops a series of revisions. You can access any of these by checking out a revision. If you work alone it's unlikely that you'll be doing much checking out unless you lose your code files or want to work on a different machine. In these cases you'll usually check out the latest revision of all files.
For my own part, i no longer keep files or folders named 'project_old' when I decide to refactor something. Any changes I make are stored incrementally and I will always be able to step backwards to a project that worked as a whole. I rarely use FTP to deploy now because I just checkout my code through ssh. Only the files I've changed are downloaded and if I need to reload on the server the terminal is already there.
It's a google talk where Linus Torvalds makes an argument for using one version control system over another. In doing so he explains how they work using concepts and then compares different ways of implementing them.
You'll probably want something like subversion even if you're working by yourself so that you have a history of all your changes. You might want to see what a piece of code looked like once upon a time to remember why you made a change.
Having source control is also useful when you check in often. If you check in often, you'll always be in a state to roll back often too. Many times you could start going down one path to solve a problem and then realise it was the wrong path to go. Many times you could just keep barking down the wrong path and end up building a terrible solution - only because you didn't want to lose all your work. By checking in often, the last point of "happiness" is not far away so even if you go down the wrong path you can always roll back and try again and make a more elegant and simple solution. Which is always a good thing so you can understand and maintain what you wrote in the future.
It depends on the size of the project and how often you change your mind about parts of it. For small projects where you're just getting something done in a linear fashion, version control is probably not going to be of much help (though if you accidentally delete or corrupt a file without version control, you'll be crying).
But a couple of weeks ago I met a friend who was writing an enormous hobby project on his own. He had ten or twenty copies of his code, with suffixes like "X1", "X2", "test", "faster" and so forth.
If you've made more than two copies of your code, you need version control. A good version control system lets you undo a change you made a while ago without undoing the stuff you did after making that change. It lets you see when certain changes were made. It lets you split your code into two "paths" (e.g. one for testing out a new idea, the other to keep your "tried and trusted" code safe until you've finished testing) and then merge them back together.
It is 2019. I am encountering objections, at this relative late date, to using Git; objections I see some raising here. This discussion has clarified greatly the imperative of using source control rather than simply making named back-up copies. One key point is source control use even where we've single developer projects. Nobody is perfect. You make mistakes. If you're exceptionally good and smart you're going to be developing more complex apps; but you're still gonna make some mistakes and this handles it. Geez oh Pete! I never use Linux but I think we all respect the great technical intelligence of Linus Torvalds. He recognized the importance of source control and he made key contributions to the inception of Git. That's a summary point for all the reasons given here. Torvalds gets it: source control is very important: use source control. Thanks to all who've commented on this long running topic.
发布评论
评论(20)
您是否曾经:
在这些情况下,毫无疑问,在其他情况下,版本控制系统应该让您的生活更轻松。
错误引用朋友的话:文明时代的文明工具。
Have you ever:
In these cases, and no doubt others, a version control system should make your life easier.
To misquote a friend: A civilised tool for a civilised age.
即使您独自工作,您也可以从源代码控制中受益。其中,由于以下原因:
您不会失去任何东西。我再也没有注释掉代码。我干脆删除它。它不会弄乱我的屏幕,也不会丢失。我可以通过检查旧的提交来恢复它。
你可以随意实验。如果不能解决问题,则恢复。
您可以查看以前版本的代码以找出引入错误的时间和位置。
git bisect
在这方面非常棒。更多“高级”功能(例如分支和合并)让您拥有多条并行的开发线。您可以同时使用两个功能,而不会产生干扰,并且可以轻松地来回切换。
您可以看到“发生了什么变化”。这听起来可能很基本,但我发现自己经常检查这一点。我经常以这样的方式开始我的单人工作流程:我昨天做了什么?
继续尝试吧。慢慢地从基本功能开始,然后逐步学习其他功能。您很快就会发现您将永远不想回到没有 VCS 的“黑暗时代”。
如果您想要本地 VCS,您可以设置自己的 subversion 服务器(我过去就是这样做的),但今天我建议使用
git
。简单多了。只需cd
到您的代码目录并运行:欢迎来到俱乐部。
Even if you work alone you can benefit from source control. Among others, for these reasons:
You don't lose anything. I never again commented out code. I simply delete it. It doesn't clutter my screen, and it isn't lost. I can recover it by checking out an old commit.
You can experiment at will. If it doesn't solve the problem, revert it.
You can look at previous versions of the code to find out when and where bugs were introduced.
git bisect
is great in that regard.More "advanced" features like branching and merging let you have multiple parallel lines of development. You can work in two simultaneous features without interference and switch back and forth without much hassle.
You can see "what changed". This may sound basic, but that's something I find myself checking a lot. I very often begin my one-man workflow with: what did I do yesterday?
Just go ahead and try it. Start slowly with basic features and learn others as you go. You will soon find that you won't ever want to go back to "the dark ages" of no VCS.
If you want a local VCS you can setup your own subversion server (what I did in the past), but today I would recommend using
git
. Much simpler. Simplycd
to your code directory and run:Welcome to the club.
版本控制是一种罕见的工具,我认为它是绝对必需的,即使您只是作为独立开发人员使用它。有人说它是一个赖以生存和死亡的工具,我同意这种说法。
您现在可能正在使用版本控制,即使您不知道。您是否有任何标有“XXX Php Code (December)”或“XXX.php.bak.2”的文件夹?这些已经是版本控制的形式。一个好的版本控制系统会自动为您处理这个问题。您将能够回滚到任何时间点(您已签入数据)并能够查看该数据的精确副本。
此外,如果您采用像 subversion 这样的系统,并使用远程存储库(例如您拥有的服务器上的存储库),您将有一个地方来保存所有代码。需要在其他地方获取代码副本吗?没问题,检查一下即可。家里硬盘坏了?不是问题(至少对于您的源代码而言)。
即使您现在不使用版本控制,您也可能会在职业生涯后期的某个时间点使用它,并且您可以从现在更加熟悉这些原则中受益。
Version control is a rare tool that I would say is absolutely required, even if you are only using it as a solo developer. Some people say that it's a tool that you live and die by, I agree with that assertion.
You probably use version control right now, even if you don't know it. Do you have any folders that say "XXX Php Code (December)" or "XXX.php.bak.2"? These are forms of version control already. A good version control system will take care of this for you automatically. You will be able to roll back to any point in time (that you have data checked in) and be able to see an exact copy of that data.
Furthermore, if you adopt a system like subversion, and use a remote repository (such as one on a server you own), you will have a place to keep all of your code. Need a copy of your code somewhere else? No problem, just check it out. Hard drive crash at home? Not an issue (at least with your source code).
Even if you don't use version control now, you will likely use it at one point in time later in your career and you could benefit from becoming more comfortable with the principles now.
即使独自工作,也曾发生过这种情况吗?你运行你的应用程序,有些东西不起作用,你说“昨天起作用了,我发誓我没有碰那个类/方法。”如果您定期检查代码,快速版本差异将准确显示最后一天发生的更改。
Even working alone, has this ever happened? You run your app, and something does not work and you say "that worked yesterday, and I swear I did not touch that class/method." If you are checking in code regularly, a quick version diff would show exactly what had changed in the last day.
这是一个可以说明源代码管理的有用性的场景,即使您单独工作也是如此。
上述场景表明,即使您单独工作,源代码管理也可以是一个很棒的工具。
对于单独工作,建议使用 Subversion 或 Git。任何人都可以自由地选择其中之一,但显然任何一个都比不使用任何版本控制要好。好书是“使用 Subversion 进行实用版本控制,第二版”,作者:Mike Mason 或“使用 Git 进行实用版本控制< /a>”,作者:Travis Swicegood。
原作者:比尔·卡文
Here's a scenario that may illustrate the usefulness of source control even if you work alone.
The above scenario shows that source control can be a great tool, even if you work solo.
For solo work, Subversion or Git is recommended. Anyone is free to prefer one or the other, but either is clearly better than not using any version control. Good books are "Pragmatic Version Control using Subversion, 2nd Edition" by Mike Mason or "Pragmatic Version Control Using Git" by Travis Swicegood.
Original author: Bill Karwin
即使对于单个开发人员来说,源代码控制也能带来巨大的好处。它允许您存储代码的历史记录并随时恢复到软件的先前版本。这使您可以无所畏惧地灵活地进行实验,因为您始终可以恢复到正在运行的源代码的另一个版本。
这就像有一个巨大的“撤消”按钮一直返回到您的第一行代码。
Even as a single developer source control offers a great benefit. It allows you to store your code's history and revert back to previous versions of your software at any time. This allows you fearless flexibility to experiment because you can always restore to another version of your source code that was working.
It's like having a giant "undo" button all the way back to your first line of code.
当你开始使用版本控制后,它几乎是无法生存的。如果多个开发人员在同一代码库上工作,那么它是必不可少的……但它对于单个开发人员也非常有用。
它跟踪代码中的更改并允许您回滚到以前的版本。它让您可以自由地进行实验,并且知道如果出现任何问题,您可以撤消更改。
Version control is almost impossible to live without after you start using it. It is indispensible if more than one developers are working on the same code base...but it also quite useful for a single developer.
It tracks the changes in your code and allows you to roll back to previous versions. It frees you to experiment with the knowledge that if anything breaks you can undo your changes.
您获得了安全性(在备份代码的意义上)和代码的版本控制(假设您养成了经常提交更改的习惯)。即使最终没有其他人与您一起编写代码,两者都是非常好的事情......
You gain security (in the sense of having a back-up of your code) and versioning of your code (assuming you get into a habit of committing your changes often). Both are very good things even if nobody else ends up ever working on the code with you...
版本控制非常适合检查以前的版本,即使您独自工作也是如此。例如,如果您不小心删除了代码或文件,您可以将其恢复;或者您可以比较以前的版本,看看为什么会出现新的错误。如果您是一个人在多个地点工作,这也很好。
我个人最喜欢的是 git。
Version control is great for checking previous versions, even if you're working alone. For example, if you accidentally delete code or a file you can get it back; or you can compare previous versions to see why a new bug has crept in. It's also good if you're one person working in multiple locations.
My personal favourite is git.
使用版本控制的原因有很多,即使您是唯一接触代码的人。
如果您将代码置于版本控制之下,那么就可以很容易地看到您已更改的文件(或忘记添加到基线中)。
There are a number of reasons to use version control, even if you are the only person who will ever touch the code.
If you keep your code under version control, then it makes it really easy to see which files you have changed (or have forgotten to add to the baseline).
其他人似乎没有明确提到的是版本的标记或标签。如果您有一个客户使用您的软件版本 1,而您正忙于开发版本 2,那么当客户报告错误并且您需要构建版本 1.1 时,您会做什么?
源代码控制系统将允许您标记您制作的每个版本,以便您稍后可以返回到该版本,进行修复(并将该修复合并到新的版本 2 代码中)并制作新版本,而不必担心您可能会意外地交付某些内容还没准备好。
源代码控制是现代软件开发的核心部分。如果您不使用它(即使对于个人项目,因为您拥有的经验越多越好),那么您就做错了。
通常,我在面试工作时问的第一个问题是“你用什么来进行源代码控制?”到目前为止,只有一个地方说“什么都没有”,但他们计划修复“现在很快......”
Something that no one else seems to have explicitly mentioned is the tagging or labeling of releases. If you have a client using version 1 of your software and you're busy working on version 2 what do you do when the client reports a bug and you need to build version 1.1?
A source control system will let you label every release you make so you can go back to it later, make the fix (and merge that fix into the new version 2 code) and make a new release without worrying that you might accidentally deliver something that isn't ready.
Source control is a core part of modern software development. If you're not using it (even for personal projects as the more experience you have the better) you're doing something wrong.
Usually one of the first questions I ask when being interviewed for a job is "What do you use for source control?" So far only one place has said "Nothing" but they were planning to fix that "Real soon now..."
其他开发人员参与或不参与的事实与版本控制系统的需求完全正交。
您可以是唯一的开发人员,但仍然会受益于:
现在,如果您有一个在同一代码库上开发的小组,则版本控制仍然更加必要,以便
当涉及更多人时,您选择哪个版本控制工具更相关,具体取决于您的风格发展。
The fact that other developers participate or not is totally orthogonal to the need of a version control system.
You can be the only developer but still will benefit from:
Now, if you have a group developing on the same codebase version control is still more necessary so
When there is more people involved it is more relevant which version control tool you pick, depending on the style of development.
它还与备份旧文件有关,这就是为什么它被称为“Subversion”。因此,您可以管理工作的多个版本,在其中可以返回(恢复)并管理它的不同实现(分支)。
It is also about backing up old file that why it is called "Subversion". So you can manage multiple version of your work in which you can return back (revert) and manage the different implementation of it (branching).
您可能会发现您的程序有一个工作版本。
您决定在一段时间内添加一些新功能并发布它。
您开始收到影响一些您认为没有接触过的代码的错误报告。
例如,通过使用 SVN,您可以返回到旧版本,并检查是否存在新错误。一旦找到引入错误的版本,修复它就会更容易,因为您可以将有效的版本与无效的版本进行比较,看看发生了什么变化,然后它就会缩小搜索范围。
源代码控制有很多用途,即使您是唯一的开发人员。
You may find that you had a working version of your program.
You decide to add a few new features over a period of time and you release that.
You start getting bug reports affecting some code that you thought you didn't touch.
By using SVN, for example, you can move back to an older version, and check to see if the new bug exists. Once you find a version that introduced the bug it will be easier to fix it as you can compare the version that worked to what didn't work and see what changed, then it will narrow down the search.
Source control has many uses, even if you are the only developer.
听起来您正在寻找更轻量的东西。查看 Mercurial(很棒的参考书)。我用它来处理一切事情,从源代码到个人信件。
一些好处:
Sounds like you're looking for something a bit more light-weight. Check out Mercurial (awesome reference book). I use it for everything, from source code to personal correspondence.
Some benefits:
即使您还没有遇到过需要旧版本程序的情况,拥有源代码控制也可以让您更有信心进行重大更改。
我发现自己在使用源代码管理后进行了更积极的重构,因为我一直知道可以轻松恢复工作版本。
Even if you haven't been in a situation yet where you needed an older version of your program, having a source control gives you greater confidence to make major changes.
I found myself doing more aggressive refactoring after using source control because I always knew that a working version could be easily restored.
我也是最近才开始对版本控制感兴趣。在版本控制系统中,您有代码存储库的概念。可以快速学习大量新的 shell 命令,以便您可以与此存储库进行交互。
将代码保存到文件后,您可以将其提交到项目的存储库中。当您开发代码并提交更改时,存储库会开发一系列修订。您可以通过签出修订来访问其中任何一个。如果您单独工作,则不太可能进行大量检查,除非您丢失了代码文件或想要在另一台机器上工作。在这些情况下,您通常会查看所有文件的最新版本。
就我自己而言,当我决定重构某些内容时,我不再保留名为“project_old”的文件或文件夹。我所做的任何更改都会增量存储,并且我始终能够退回到作为一个整体运行的项目。我现在很少使用FTP来部署,因为我只是通过ssh签出我的代码。仅下载我更改过的文件,如果我需要在服务器上重新加载,则终端已经存在。
我发现关于 GIT 的演讲非常有启发性; http://www.youtube.com/watch?v=4XpnKHJAok8
这是 Google讨论 Linus Torvalds 争论使用一种版本控制系统而不是另一种版本控制系统。在此过程中,他使用概念解释了它们如何工作,然后比较了实现它们的不同方法。
I have also only recently begun to get interested in version control. In version control systems, you have the concept of a repository for your code. A wealth of new shell commands get learned very quickly so that you can interact with this repository.
Once you save your code to a file, you can then commit this to your project's repository. As you develop your code and commit your changes the repository develops a series of revisions. You can access any of these by checking out a revision. If you work alone it's unlikely that you'll be doing much checking out unless you lose your code files or want to work on a different machine. In these cases you'll usually check out the latest revision of all files.
For my own part, i no longer keep files or folders named 'project_old' when I decide to refactor something. Any changes I make are stored incrementally and I will always be able to step backwards to a project that worked as a whole. I rarely use FTP to deploy now because I just checkout my code through ssh. Only the files I've changed are downloaded and if I need to reload on the server the terminal is already there.
I found this talk on GIT to be really instructive; http://www.youtube.com/watch?v=4XpnKHJAok8
It's a google talk where Linus Torvalds makes an argument for using one version control system over another. In doing so he explains how they work using concepts and then compares different ways of implementing them.
即使您自己工作,您也可能需要像 subversion 这样的东西,以便拥有所有更改的历史记录。您可能想看看一段代码以前是什么样子,以记住为什么要进行更改。
当您经常签入时,拥有源代码控制也很有用。如果你经常签入,你也会一直处于经常回滚的状态。很多时候,您可能会开始沿着一条道路解决问题,然后意识到这是一条错误的道路。很多时候,您可能会继续沿着错误的道路咆哮,最终构建出一个糟糕的解决方案 - 只是因为您不想失去所有的工作。通过经常检查,最后一点“幸福”就在不远处,所以即使你走错了路,你也可以随时回滚并重试,并做出更优雅和简单的解决方案。这总是一件好事,这样您将来就可以理解并维护您所写的内容。
You'll probably want something like subversion even if you're working by yourself so that you have a history of all your changes. You might want to see what a piece of code looked like once upon a time to remember why you made a change.
Having source control is also useful when you check in often. If you check in often, you'll always be in a state to roll back often too. Many times you could start going down one path to solve a problem and then realise it was the wrong path to go. Many times you could just keep barking down the wrong path and end up building a terrible solution - only because you didn't want to lose all your work. By checking in often, the last point of "happiness" is not far away so even if you go down the wrong path you can always roll back and try again and make a more elegant and simple solution. Which is always a good thing so you can understand and maintain what you wrote in the future.
这取决于项目的规模以及您对其中某些部分改变主意的频率。对于您只是以线性方式完成某些工作的小型项目,版本控制可能不会有太大帮助(尽管如果您不小心删除或损坏了没有版本控制的文件,您会哭泣)。
但几周前,我遇到了一位朋友,他正在自己编写一个巨大的爱好项目。他有十到二十份代码副本,带有“X1”、“X2”、“测试”、“更快”等后缀。
如果您制作了两份以上的代码副本,您需要版本控制。一个好的版本控制系统可以让您撤消之前所做的更改,而无需撤消更改后所做的操作。它可以让您看到何时进行了某些更改。它可以让您将代码分成两个“路径”(例如,一个用于测试新想法,另一个用于保持“经过验证且可信”的代码安全,直到完成测试),然后将它们合并在一起。
It depends on the size of the project and how often you change your mind about parts of it. For small projects where you're just getting something done in a linear fashion, version control is probably not going to be of much help (though if you accidentally delete or corrupt a file without version control, you'll be crying).
But a couple of weeks ago I met a friend who was writing an enormous hobby project on his own. He had ten or twenty copies of his code, with suffixes like "X1", "X2", "test", "faster" and so forth.
If you've made more than two copies of your code, you need version control. A good version control system lets you undo a change you made a while ago without undoing the stuff you did after making that change. It lets you see when certain changes were made. It lets you split your code into two "paths" (e.g. one for testing out a new idea, the other to keep your "tried and trusted" code safe until you've finished testing) and then merge them back together.
现在是 2019 年。在这个相对较晚的日期,我遇到了使用 Git 的反对意见;我看到有人提出反对意见。这次讨论极大地阐明了使用源代码控制而不是简单地制作命名备份副本的必要性。一个关键点是源代码控制的使用,即使我们只有单个开发人员项目。没有人是完美的。你会犯错误。如果你非常优秀和聪明,你就会开发出更复杂的应用程序;但你仍然会犯一些错误,这可以解决它。天哪,皮特!我从不使用 Linux,但我认为我们都尊重 Linus Torvalds 伟大的技术智慧。他认识到源代码控制的重要性,并为 Git 的诞生做出了重要贡献。这是这里给出的所有原因的总结点。 Torvalds 明白了:源代码控制非常重要:使用源代码控制。感谢所有对这个长期话题发表评论的人。
It is 2019. I am encountering objections, at this relative late date, to using Git; objections I see some raising here. This discussion has clarified greatly the imperative of using source control rather than simply making named back-up copies. One key point is source control use even where we've single developer projects. Nobody is perfect. You make mistakes. If you're exceptionally good and smart you're going to be developing more complex apps; but you're still gonna make some mistakes and this handles it. Geez oh Pete! I never use Linux but I think we all respect the great technical intelligence of Linus Torvalds. He recognized the importance of source control and he made key contributions to the inception of Git. That's a summary point for all the reasons given here. Torvalds gets it: source control is very important: use source control. Thanks to all who've commented on this long running topic.