git 开始使用版本控制

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:02:35  来源:igfitidea点击:

Getting started with Version Control

gitsvnversion-controllanguage-agnosticdvcs

提问by Mark Norgren

I need to implement version control, even for just the developing I do at home. I have read about how great Subversion is for the past couple years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control system.

我需要实现版本控制,即使只是我在家做的开发。在过去的几年里,我已经阅读了关于 Subversion 是多么伟大的文章,并且我正准备致力于学习这方面的知识,直到我听说 Git 是即将到来的版本控制系统。

Given the situation, should I hold off and see which one comes out on top? What are their relative advantages?

鉴于这种情况,我应该暂缓一下,看看哪个排名靠前?它们的相对优势是什么?

One issue I noticed with Git is there are not many full featured GUIs, which is important to many users on my team.

我注意到 Git 的一个问题是没有很多功能齐全的 GUI,这对我团队中的许多用户来说很重要。

Also, wouldn't mind suggestions on how to get started with one or the other. (tutorials, etc.)

此外,不介意如何开始使用其中一个的建议。(教程等)

回答by Jonathan Works

The most important thing about version control is:

版本控制最重要的是:

JUST START USING IT

刚开始使用它

Not using version control is a horrible idea. If you are not using version control, stop reading right now and start using it.

不使用版本控制是一个可怕的想法。如果您不使用版本控制,请立即停止阅读并开始使用它。

It is very easy to convert from

很容易从

cvs<->svn<->git<->hg

It doesn't matter which one you choose. Just pick the easiest one for you to use and start recording the history of your code. You can always migrate to another (D)VCS later.

你选择哪一个并不重要。只需选择最简单的一个供您使用并开始记录您的代码历史。您以后可以随时迁移到另一个 (D)VCS。

If you are looking for a easy to use GUI look at TortoiseSVN (Windows)and Versions (Mac)(Suggested by codingwithoutcomments)

如果您正在寻找易于使用的 GUI,请查看TortoiseSVN (Windows)版本 (Mac)(由codingwithoutcomments建议)



Edit:

编辑:

pix0r said:

Git has some nice features, but you won't be able to appreciate them unless you've already used something more standard like CVS or Subversion.

pix0r 说:

Git 有一些不错的特性,但除非你已经使用过更标准的东西,比如 CVS 或 Subversion,否则你将无法欣赏它们。

This. Using git is pointless if you don't know what version control can do for you.

这个。如果您不知道版本控制可以为您做什么,那么使用 git 毫无意义。

Edit 2:

编辑2:

Just saw this link on reddit: Subversion Cheat Sheet. Good quick reference for the svn command line.

刚刚在 reddit 上看到了这个链接:Subversion Cheat Sheet。svn 命令行的快速参考。

回答by Karl Seguin

Use subversion, it's easy to setup, easy to use, and has plenty of tools. Any future revision system will have an import from SVN feature, so it isn't like you can't change down the road if your needs grow.

使用subversion,设置简单,使用方便,工具丰富。任何未来的修订系统都将具有从 SVN 导入的功能,因此如果您的需求增长,您也不会在未来无法更改。

回答by pix0r

The Subversion Bookis your best bet for learning the tool. There may be other quick-start tutorials out there, but the Book is the best single reference you'll find.

颠覆书是学习的工具,你最好的选择。可能还有其他快速入门教程,但本书是您能找到的最好的单一参考。

Git has some nice features, but you won't be able to appreciate them unless you've already used something more standard like CVS or Subversion. I'd definitely agree with the previous posters and start with Subversion.

Git 有一些不错的特性,但除非你已经使用过更标准的东西,比如 CVS 或 Subversion,否则你将无法欣赏它们。我绝对同意之前的海报并从 Subversion 开始。

回答by John Smithers

If you are new to versioncontrol read this:
Source Control HOWTO

如果您不熟悉版本控制,请阅读以下内容:
Source Control HOWTO

回答by Vaibhav

Go for SVN. If you have never used source control before, it won't matter to you one way or the other.

去SVN。如果您以前从未使用过源代码控制,那么无论哪种方式对您来说都无关紧要。

Also, there is not a large amount of learning involved in using a Source Control system. If you learn one, you can easily switch over to another at a later date.

此外,使用源代码控制系统不需要进行大量学习。如果您学习了其中一个,您可以在以后轻松切换到另一个。

SVN is a great tool, and it should take care of most of your needs. And since it's been around, it has a fair sharer of GUI tools (TortoiseSVN, for example).

SVN 是一个很棒的工具,它应该可以满足您的大部分需求。并且因为它已经存在,它有一个公平的 GUI 工具共享者(例如 TortoiseSVN)。

Go for SVN.

去SVN。

回答by Rytmis

For a friendly explanation of most of the basic concepts, see A Visual Guide to Version Control. The article is very SVN-friendly.

有关大多数基本概念的友好解释,请参阅版本控制的可视化指南。这篇文章对 SVN 非常友好。

回答by Nick Brosnahan

I've used RCS, CVS, SCCS, SourceSafe, Vault, perforce, subversion, and git.

我使用过 RCS、CVS、SCCS、SourceSafe、Vault、perforce、subversion 和 git。

I've evaluated BitKeeper, Dimensions, arch, bazaar, svk, ClearCase, PVCS, and Synergy.

我评估了 BitKeeper、Dimensions、arch、bazaar、svk、ClearCase、PVCS 和 Synergy。

If I had to start a new repository today, I'd choose git. Hands down.

如果我今天必须开始一个新的存储库,我会选择git。把手放下。

It's free, fast, and under active development.

它是免费的、快速的,并且正在积极开发中。

And you can use it as a client of any subversion repository using git-svn.

您可以使用 git-svn 将其用作任何 subversion 存储库的客户端。

It rocks.

它岩石。

回答by Orion Edwards

@superjoe30

What about using source control on your own computer, if you're the sole programmer? Is this good practice? Are there related tips or tricks?

@超级乔30

如果您是唯一的程序员,那么在您自己的计算机上使用源代码管理怎么样?这是好的做法吗?有没有相关的提示或技巧?

I find git is actually easier for this as you don't need a server or worry about entering URL's and so on. Your version-control stuff just lives in the .gitdirectory inside your project and you just go ahead and use it.

我发现 git 实际上更容易做到这一点,因为您不需要服务器或担心输入 URL 等等。您的版本控制内容就.git在您项目的目录中,您只需继续使用它即可。

5 second intro (assuming you have installed it)

5 秒介绍(假设您已安装)

cd myproject
git init
git add * # add all the files
git commit

Next time you do some changes

下次你做一些改变

git add newfile1 newfile2 # if you've made any new files since last time
git commit -a

As long as you're doing that, git has your back. If you mess up, your code is safe in the nice git repository. It's awesome

只要你这样做,git就会支持你。如果你搞砸了,你的代码在漂亮的 git 存储库中是安全的。这很棒

  • Note: You may find getting things OUT of git a bit harder than getting them in, but it's far more preferable to have that problem than to not have the files at all!
  • 注意:您可能会发现从 git 中取出东西比将它们放入更难一些,但是有这个问题比根本没有文件要好得多!

回答by Sam Stokes

From my own experience with it, I wouldn't recommend git as an introduction to version control. I've been using it for a couple of months now, and my impression is that it's very powerful and - now that I've partially got my head around it - reasonably intuitive. However, the learning curve is very steep, even though I've been using version control for years. It also suffers from being too expressive - it supports many different workflows and development models, but the only guidance on "the best" way to use it is a few pages deep in a Google search, which also makes it tricky for a newcomer to pick up.

根据我自己的经验,我不推荐 git 作为版本控制的介绍。我已经使用它几个月了,我的印象是它非常强大,而且 - 现在我已经部分了解它 - 相当直观。然而,学习曲线非常陡峭,即使我多年来一直在使用版本控制。它也有表现力太强的问题——它支持许多不同的工作流程和开发模型,但关于“最佳”使用方式的唯一指导是谷歌搜索中的几页深度,这也让新手很难选择向上。

That said, it's possible that starting from a blank slate with git might actually be easier - my VCS experience is all with centralised version control (CVS, SVN, Perforce...) and part of my (ongoing!) difficulty with git has been understanding the implications of the distributed model. I did glance briefly at other DVCSes like Bazaar and Mercurial and they seemed to be somewhat more newbie-friendly.

也就是说,从空白开始使用 git 实际上可能更容易 - 我的 VCS 经验都是集中式版本控制(CVS、SVN、Perforce ...),而我(正在进行!)使用 git 的部分困难一直是理解分布式模型的含义。我确实看了一眼其他 DVCS,比如 Bazaar 和 Mercurial,它们似乎对新手更友好。

Anyway, as others have said, Subversion is probably the easiest way to get used to the version control mindset and get practical experience of the benefits of VCS (rollback, branches, collaborative development, easier code review, etc).

无论如何,正如其他人所说,Subversion 可能是习惯版本控制思维方式并获得 VCS 好处(回滚、分支、协作开发、更容易的代码等)的实践经验的最简单方法。

Oh, and don't start with CVS. It's still in practical use, and has advantages, but IMHO it has too many historical quirks and implementation problems (non-atomic commits!) to be a good way to learn.

哦,不要从 CVS 开始。它仍然在实际使用中,并且有优势,但恕我直言,它有太多的历史怪癖和实现问题(非原子提交!)是一种很好的学习方式。

回答by DShook

Also try out visual svnfor your server if you want to avoid any command line work.

如果您想避免任何命令行工作,还可以为您的服务器尝试Visual svn