9

我使用“传统”版本控制系统来维护过去项目的源代码存储库。我正在与一个分布式团队开始一个新项目,我可以看到使用分布式系统的优势。鉴于我了解 SourceSafe、CVS 和 Subversion;你对 Git 新手有什么建议?

4

5 回答 5

12

Git - SVN Crash Course是一本很好的入门读物。

于 2008-09-24T12:26:00.230 回答
7

In my own experience moving from Subversion to Git, the most important thing is not what you need to learn, but what you need to unlearn. Distributed Version Control is very different from Centralized Version Control. CVC is a subset of DVC, so you can just do CVC in a DVC tool, but it will be more complicated than with a CVC tool.

Try to unlearn CVC, and get in the DVC mindset. If you just end up doing CVC in a DVC tool, you will merely be frustrated by all the added complexity and you will not realize what that added complexity is buying you in terms of flexibility.

All DVC tools have great and very powerful support for branching and merging. Use it. All the history is available at your fingertips. Use it. (For example: never comment out code, just delete it. You can always get it back, even on an airplane with no internet connection.)

One very important aspect of Git: all other tools have a more or less defined workflow. Git doesn't. Git is a DVCS workflow construction kit. This makes it sometimes hard to know what to do: you have to design and implement your own workflow (hint: use lots of shell scripts). I use Git for more than a year now, and I still haven't completely figured out my workflow yet.

于 2008-09-28T05:22:16.303 回答
3

教程

然后玩弄它。在开始使用主代码库之前,先做一个小玩具项目来感受一下。

我经常使用 gitk 来查看补丁并跟踪代码从提交到提交是如何变化的。

于 2008-09-24T13:44:12.770 回答
2

在提交文件之前,必须每次都将它们添加到 Git 暂存区。为了使这更容易,有一个-a选项可以添加所有跟踪的文件,如git commit -a.

此外,当您这样做时git diff,它只会显示您的工作副本与暂存区域中的内容之间的区别。如果您已将更改的文件添加到暂存区域,git diff即使您可能有未提交的更改,也可能不会报告任何内容。用git status来看肯定的。

于 2008-09-24T12:53:55.763 回答
-1

我在我的公司尝试了 git。我们使用 CVS 并希望转向更好的 VC 工具。我们选择 git 作为文件版本控制的最佳工具(Linus on GIT)。它的性能是最好的,对于深入了解版本控制的开发人员来说,它是一个非常好的工具,但对于在后台使用版本控制并且不想学习如何使用的普通开发人员来说,这是一场噩梦。几个小时(他们确实需要学习很多东西)

此外,它与现有 IDE 的集成距离完整还很遥远。对于普通开发人员来说,整体可用性是相当大的问题。

在与 4 名开发人员进行试点之后,我们切换到了 Subversion,因为它是最简单但不是那么优越的工具。

Subversion MultiSite 也有商业解决方案(我们还没有尝试,但很快就会尝试) - WANDisco

于 2008-09-24T18:52:23.793 回答