在我开始使用它之前,我应该了解Git的哪些方面?

时间:2022-09-11 10:32:04

I have used "traditional" version control systems to maintain source code repositories on past projects. I am starting a new project with a distributed team and I can see advantages to using a distributed system. Given that I understand SourceSafe, CVS, and Subversion; what suggestions do you have for a Git newbie?

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

5 个解决方案

#1


12  

The Git - SVN Crash Course is a good read for getting going.

Git - SVN速成课程是一个很好的阅读。

#2


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.

根据我自己从Subversion迁移到Git的经验,最重要的不是你需要学习的东西,而是你需要忘记的东西。分布式版本控制与集中版本控制非常不同。 CVC是DVC的一个子集,因此您可以在DVC工具中进行CVC,但它比使用CVC工具更复杂。

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.

尝试忘掉CVC,并进入DVC思维模式。如果你最终只是在DVC工具中做CVC,你只会对所有增加的复杂性感到沮丧,你不会意识到增加的复杂性会给你带来灵活性。

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.)

所有DVC工具都对分支和合并提供了强大而强大的支持。用它。所有历史记录都在您的指尖。用它。 (例如:永远不会注释掉代码,只需删除它。即使在没有互联网连接的飞机上,也可以随时取回代码。)

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.

Git的一个非常重要的方面:所有其他工具都有或多或少定义的工作流程。 Git没有。 Git是一个DVCS工作流程构建工具包。这使得有时很难知道该怎么做:你必须设计和实现自己的工作流程(提示:使用大量的shell脚本)。我现在使用Git超过一年了,我还没有完全弄清楚我的工作流程。

#3


3  

Do the tutorial

做教程

Then play around with it. Do a little toy project to get a feel for it before you starting working with your main codebase.

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

I use gitk a lot to review patches and track how the code changes from commit to commit.

我经常使用gitk来查看补丁并跟踪代码如何从提交更改为提交。

#4


2  

Before committing files, they have to be added to the Git staging area — every time. To make this easier, there is a -a option to add all tracked files, as in git commit -a.

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

Also, when you do git diff, it only shows you the difference between your working copy and what's in the staging area. If you've added changed files to your staging area, git diff may report nothing even though you may have uncommitted changes. Use git status to see for sure.

此外,当您执行git diff时,它仅显示您的工作副本与暂存区域中的内容之间的差异。如果您已将更改的文件添加到暂存区域,即使您可能有未提交的更改,git diff也可能不会报告任何内容。使用git status可以确定。

#5


-1  

I tried git in my company. We used CVS and wanted to move to a better VC tool. We have chosen git as a best tool for files versioning (Linus on GIT). Its performance is just the best and it is a really great tools for a developer who understands version control in-depth but It is a nightmare for a regular developers who uses version control in background and don't want learn how to use for more than few hours (and they do need to learn a lot)

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

Also it's integration with existing IDEs is far away for being complete. The whole usability is pretty big issue for a regular developer.

此外,它与现有IDE的集成还远远不够完善。对于常规开发人员来说,整个可用性是一个非常大的问题。

After a pilot with 4 developers we switched to Subversion as simplest although not so superior tool.

在有4位开发人员的试点后,我们切换到最简单的Subversion,尽管不是那么优秀的工具。

There is also commercial solution for Subversion MultiSite (which we didn't try yet but will try shortly) - WANDisco

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

#1


12  

The Git - SVN Crash Course is a good read for getting going.

Git - SVN速成课程是一个很好的阅读。

#2


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.

根据我自己从Subversion迁移到Git的经验,最重要的不是你需要学习的东西,而是你需要忘记的东西。分布式版本控制与集中版本控制非常不同。 CVC是DVC的一个子集,因此您可以在DVC工具中进行CVC,但它比使用CVC工具更复杂。

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.

尝试忘掉CVC,并进入DVC思维模式。如果你最终只是在DVC工具中做CVC,你只会对所有增加的复杂性感到沮丧,你不会意识到增加的复杂性会给你带来灵活性。

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.)

所有DVC工具都对分支和合并提供了强大而强大的支持。用它。所有历史记录都在您的指尖。用它。 (例如:永远不会注释掉代码,只需删除它。即使在没有互联网连接的飞机上,也可以随时取回代码。)

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.

Git的一个非常重要的方面:所有其他工具都有或多或少定义的工作流程。 Git没有。 Git是一个DVCS工作流程构建工具包。这使得有时很难知道该怎么做:你必须设计和实现自己的工作流程(提示:使用大量的shell脚本)。我现在使用Git超过一年了,我还没有完全弄清楚我的工作流程。

#3


3  

Do the tutorial

做教程

Then play around with it. Do a little toy project to get a feel for it before you starting working with your main codebase.

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

I use gitk a lot to review patches and track how the code changes from commit to commit.

我经常使用gitk来查看补丁并跟踪代码如何从提交更改为提交。

#4


2  

Before committing files, they have to be added to the Git staging area — every time. To make this easier, there is a -a option to add all tracked files, as in git commit -a.

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

Also, when you do git diff, it only shows you the difference between your working copy and what's in the staging area. If you've added changed files to your staging area, git diff may report nothing even though you may have uncommitted changes. Use git status to see for sure.

此外,当您执行git diff时,它仅显示您的工作副本与暂存区域中的内容之间的差异。如果您已将更改的文件添加到暂存区域,即使您可能有未提交的更改,git diff也可能不会报告任何内容。使用git status可以确定。

#5


-1  

I tried git in my company. We used CVS and wanted to move to a better VC tool. We have chosen git as a best tool for files versioning (Linus on GIT). Its performance is just the best and it is a really great tools for a developer who understands version control in-depth but It is a nightmare for a regular developers who uses version control in background and don't want learn how to use for more than few hours (and they do need to learn a lot)

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

Also it's integration with existing IDEs is far away for being complete. The whole usability is pretty big issue for a regular developer.

此外,它与现有IDE的集成还远远不够完善。对于常规开发人员来说,整个可用性是一个非常大的问题。

After a pilot with 4 developers we switched to Subversion as simplest although not so superior tool.

在有4位开发人员的试点后,我们切换到最简单的Subversion,尽管不是那么优秀的工具。

There is also commercial solution for Subversion MultiSite (which we didn't try yet but will try shortly) - WANDisco

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