什么是Git,为什么我需要它? [英] What is Git and why do I want it?

查看:143
本文介绍了什么是Git,为什么我需要它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对编程相当陌生,但我觉得我已经掌握了它,并且尽力学习。我一直在阅读Git对于编程项目绝对至关重要,但我似乎无法弄清楚它实际上做了什么。 Google也不想告诉我。该网站称它是一个分布式版本控制系统。呃...呵呵?



有人可以向新手解释这件事是什么,为什么这么重要?


$
b $ b

让我们从一个版本控制系统的概念开始。这正是它所说的 - 这是一种存储和管理各种版本的东西的方法。这在编程中非常重要,因为在您开发项目时,项目会发生很多次变化,并且访问比当前版本更多的内容通常很有用。它也将被多人改变;必须有某种方式来结合每个人的变化。



最简单的版本控制可能是简单地备份整个项目,然后传递这些快照或各种开发人员之间的补丁。显然你会用这种天真的方法开始遇到困难;这是专用版本控制系统的功能。

版本控制系统将以智能方式跟踪您的所有历史记录,并允许您浏览历史记录,看到关于变化的一切:他们是什么,是谁制造的,以及为什么。稍微复杂一些,他们通常会有一些分支的概念(创造不同的开发线,也许对于多个开发者)和合并(将这些分支结合在一起)。大多数版本控制系统都会在这一切之上提供许多更高级别的功能。仅仅为了一个例子,git有一个名为bisect的工具,它可以让你在你的历史记录中进行二进制搜索,找出何时引入了一个特定的错误。整洁的东西。

版本控制有两大类:集中式和分布式。在中央系统中,有一个中央存储库。它包含项目的所有历史,任何想要与该历史交互的人都必须经过该中央存储库。另一方面,像git这样的分布式系统为每个人提供了历史。每个开发人员最终都会得到一个完全自给自足的仓库副本(在git中称为克隆)。没有必要与公共中央存储库进行交互,除非作为实际问题,这是一种发布内容供其他人查看的方式。这使得多个人同时在同一个项目上工作变得简单多了,可能没有互联网访问权限,并且也为每个人提供版本控制系统的全部功能,而不是有限的公众中央仓库的功能。



为了更好地定性阅读如何最终构建像git这样的系统,从想要记住历史的基础开始,尝试 git寓言



有关该主题的更多一般信息,请尝试维基百科:版本控制 a>。


I'm pretty new to programming but I feel I'm getting the hang of it and I'm trying to learn as much as I can. I keep reading that Git is absolutely vital to a programming project, but I can't seem to figure out what it actually does. Google doesn't want to tell me either. The website says it is "a distributed version control system." Er... huh?

Could someone please explain to the neophyte what this thing is and why it's so vital?

解决方案

The website says it is "a distributed version control system."

Let's start with the idea of a version control system. It's exactly what it says - it's a way to store and manage various versions of something. This is extremely important in programming, because a project is going to be changed many, many times as you develop it, and it will frequently be useful to have access to more than the current version. It's also going to be changed by multiple people; there has to be some way to combine everyone's changes.

The simplest possible version control would be to simply back up your entire project now and then, and pass either these snapshots or patches around between various developers. Obviously you would start running into difficulties eventually with such a naive approach; that's where dedicated version control systems come in.

A version control system will keep track of all of your history in an intelligent way, and allow you to browse that history, seeing everything about the changes: what they were, who made them, and why. Slightly more complex, they'll often have some notion of branching (creating divergent lines of development, perhaps for multiple developers) and merging (bringing those branches back together). Most version control systems will provide a lot of higher-level functionality on top of all this too. Just for a single example, git has a tool called "bisect" which will let you do a binary search through your history to find when a particular bug was introduced. Neat stuff.

There are two broad classifications of version control: centralized and distributed. In a centralized system, there is one central repository. It contains all of the history of the project, and anyone who wants to interact with that history has to go through that central repository. A distributed system like git, on the other hand, gives everyone that history. Each developer will end up with a copy (called a clone, in git) of the repository, which is completely self-sufficient. There's no need to interact with a public central repository except as a practical matter, a way of publishing content for others to see. This makes it much simpler for multiple people to work on the same project at the same time, possibly without having internet access, and also gives each of those people the full power of the version control system within their own repository, instead of the limited public functionality of the central repository.

For a great qualitative read on how you'd end up with a system like git, starting from the basics of wanting to remember history, try the git parable.

For more general information on the topic, try wikipedia: revision control.

这篇关于什么是Git,为什么我需要它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆