git GitHub 中的项目与存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40509838/
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
Project vs Repository in GitHub
提问by carlossierra
In GitHub, what is the conceptual difference between a project (that can be created inside a repository) and a repository?
在 GitHub 中,项目(可以在存储库内创建)和存储库之间的概念区别是什么?
I've seen several similar questions (here, hereand here) in SO, but none of them explains what is a GitHub project, what is a GitHub repository and when to use each one of them.
我在 SO 中看到了几个类似的问题(此处、此处和此处),但没有一个解释什么是 GitHub 项目、什么是 GitHub 存储库以及何时使用它们中的每一个。
I would appreciate if someone can explain each term, and provide an example of when to use/create each one. For instance, if I have several prototype applications, all independent of each other, what do I create in order to manage in an organized way the source code for all of them?
如果有人可以解释每个术语,并提供一个何时使用/创建每个术语的示例,我将不胜感激。例如,如果我有几个原型应用程序,它们都相互独立,我要创建什么才能以有组织的方式管理所有这些应用程序的源代码?
采纳答案by osowskit
GitHub recently introduced a new feature called Projects. This provides a visual board that is typical of many Project Management tools:
GitHub 最近推出了一项名为Projects的新功能。这提供了一个可视化板,这是许多项目管理工具的典型特征:
A Repositoryas documented on GitHub:
GitHub 上记录的存储库:
A repository is the most basic element of GitHub. They're easiest to imagine as a project's folder. A repository contains all of the project files (including documentation), and stores each file's revision history. Repositories can have multiple collaborators and can be either public or private.
存储库是 GitHub 最基本的元素。它们最容易想象为项目的文件夹。存储库包含所有项目文件(包括文档),并存储每个文件的修订历史。存储库可以有多个协作者,并且可以是公共的或私有的。
A Projectas documented on GitHub:
GitHub 上记录的项目:
Project boards on GitHub help you organize and prioritize your work. You can create project boards for specific feature work, comprehensive roadmaps, or even release checklists. With project boards, you have the flexibility to create customized workflows that suit your needs.
GitHub 上的项目板可帮助您组织工作并确定其优先级。您可以为特定功能工作、综合路线图甚至发布清单创建项目板。使用项目板,您可以灵活地创建适合您需求的自定义工作流程。
Part of the confusion is that the new feature, Projects, conflicts with the overloaded usage of the term projectin the documentation above.
部分混淆是新功能 Projects 与上述文档中术语project的重载用法相冲突。
回答by rsp
Fact 1: Projects and Repositories were always synonyms on GitHub.
Fact 2: This is no longer the case.
事实 1:项目和存储库在 GitHub 上始终是同义词。
事实 2:情况不再如此。
There is a lot of confusion about Repositories and Projects. In the past both terms were used pretty much interchangeably by the users and the GitHub's very own documentation. This is reflected by some of the answers and comments here that explain the subtle differences between those terms and when the one was preferred over the other. The difference were always subtle, e.g. like the issue tracker being part of the project but not part of the repository which might be thought of as a strictly git thing etc.
关于存储库和项目有很多混淆。过去,用户和 GitHub 自己的文档几乎可以互换使用这两个术语。此处的一些答案和评论反映了这一点,这些答案和评论解释了这些术语之间的细微差别,以及何时优先于另一个。差异总是很微妙,例如问题跟踪器是项目的一部分,而不是存储库的一部分,这可能被认为是严格的 git 东西等。
Not any more.
不再。
Currently repos and projects refer to a different kinds of entitiesthat have separate APIs:
目前 repos 和 projects 指的是具有单独 API的不同类型的实体:
Since then it is no longer correct to call the repo a project or vice versa. Note that it is often confused in the official documentation and it is unfortunate that a term that was already widely used has been chosen as the name of the new entity but this is the case and we have to live with that.
从那时起,将 repo 称为项目不再正确,反之亦然。请注意,它在官方文档中经常被混淆,不幸的是,一个已经被广泛使用的术语被选为新实体的名称,但情况确实如此,我们必须接受这一点。
The consequence is that repos and projects are usually confused and every time you read about GitHub projects you have to wonder if it's really about the projects or about repos. Had they chosen some other name or an abbreviation like "proj" then we could know that what is discussed is the new type of entity, a precise object with concrete properties, or a general speaking repo-like projectish kind of thingy.
结果是 repos 和 projects 通常被混淆了,每次你读到 GitHub 项目时,你都必须怀疑它真的是关于项目还是关于 repos。如果他们选择了其他名称或缩写,例如“proj”,那么我们就可以知道所讨论的是新类型的实体,具有具体属性的精确对象,或者一般来说类似于 repo 的投影类型的东西。
The term that is usually unambiguous is "project board".
通常明确的术语是“项目板”。
What can we learn from the API
我们可以从 API 中学到什么
The first endpoint in the documentation of the Projects API:
Projects API 文档中的第一个端点:
is described as: List repository projects. It means that a repository can have many projects. So those two cannot mean the same thing. It includes Response if projects are disabled:
描述为:列出存储库项目。这意味着一个存储库可以有多个项目。所以这两者不可能是同一个意思。如果项目被禁用,它包括响应:
{
"message": "Projects are disabled for this repo",
"documentation_url": "https://developer.github.com/v3"
}
which means that some repos can have projects disabled. Again, those cannot be the same thing when a repo can have projects disabled.
这意味着某些存储库可以禁用项目。同样,当 repo 可以禁用项目时,这些就不是一回事了。
There are some other interesting endpoints:
还有一些其他有趣的端点:
- Create a repository project-
POST /repos/:owner/:repo/projects
- Create an organization project-
POST /orgs/:org/projects
- 创建一个存储库项目-
POST /repos/:owner/:repo/projects
- 创建一个组织项目-
POST /orgs/:org/projects
but there is no:
但没有:
Create a user's project-POST /users/:user/projects
创建用户的项目-POST /users/:user/projects
Which leads us to another difference:
这导致我们另一个不同之处:
1. Repositories can belong to users or organizations
2. Projects can belong to repositories or organizations
1. 存储库可以属于用户或组织
2. 项目可以属于存储库或组织
or, more importantly:
或者,更重要的是:
1. Projects can belong to repositories but not the other way around
2. Projects can belong to organizations but not to users
3. Repositories can belong to organizations and to users
1. 项目可以属于存储库,但不能反过来
2. 项目可以属于组织,但不
属于用户3. 存储库可以属于组织和用户
See also:
也可以看看:
I know it's confusing. I tried to explain it as precisely as I could.
我知道这很混乱。我试图尽可能准确地解释它。
回答by Digamber
GitHub Repositories are used to store all the files, folders and other resources which you care about.
GitHub Repositories 用于存储您关心的所有文件、文件夹和其他资源。
Git Project : It is also one of the Resource in Git Repository and main use of it is to manage the projects with a visual board. If you create a project in Git Repository it create a visual board like a Kanban board to manage the project.
Git 项目:它也是 Git Repository 中的资源之一,主要用途是通过可视化板管理项目。如果您在 Git Repository 中创建一个项目,它会创建一个类似于看板的可视化板来管理项目。
In this way, you can have multiple projects in a repository.
通过这种方式,您可以在一个存储库中拥有多个项目。
回答by Do Nhu Vy
In general, on GitHub, 1 repository = 1 project. For example: https://github.com/spring-projects/spring-boot. But it isn't a hard rule.
通常,在 GitHub 上,1 个存储库 = 1 个项目。例如:https: //github.com/spring-projects/spring-boot。但这不是硬性规定。
1 repository = many projects. For example: https://github.com/donhuvy/java_examples
1 个存储库 = 许多项目。例如:https: //github.com/donhuvy/java_examples
1 projects = many repositories. For example: https://github.com/zendframework/zendframework(1 project named Zend Framework 3 has 61 + 1 = 62 repositories, don't believe? let count Zend Frameworks' modules + main repository)
1 个项目 = 许多存储库。例如:https: //github.com/zendframework/zendframework(1个名为 Zend Framework 3 的项目有 61 + 1 = 62 个存储库,不信?让我们算一下 Zend Frameworks 的模块 + 主存储库)
I totally agree with @Brandon Ibbotson's comment:
我完全同意@Brandon Ibbotson的评论:
A GitHub repository is just a "directory" where folders and files can exist.
GitHub 存储库只是一个可以存在文件夹和文件的“目录”。
回答by Jeremy
The conceptual difference in my understanding it that a project can contain many repo's and that are independent of each other, while simultaneously a repo may contain many projects. Repo's being just a storage place for code while a project being a collection of tasks for a certain feature.
我理解的概念差异是一个项目可以包含许多回购并且彼此独立,而同时一个回购可能包含许多项目。Repo 只是代码的存储位置,而项目则是某个功能的任务集合。
Does that make sense? A large repo can have many projects being worked on by different people at the same time (lots of difference features being added to a monolith), a large project may have many small repos that are separate but part of the same project that interact with each other - microservices? Its a personal take on what you want to do. I think that repo (storage) vs project (tasks) is the main difference - if i am wrong please let me know / explain! Thanks.
那有意义吗?一个大的 repo 可以有很多项目同时被不同的人处理(很多不同的特性被添加到一个整体中),一个大的项目可能有许多小 repo,它们是独立的,但属于同一个项目的一部分,它们与每个人交互其他 - 微服务?它是对你想做的事情的个人看法。我认为回购(存储)与项目(任务)是主要区别 - 如果我错了,请告诉我/解释!谢谢。
回答by Anshu Aditya
With respect to the git vocabulary, a Projectis the folder in which the actual content(files) lives. Whereas Repository (repo)is the folder inside which git keeps the record of every change been made in the projectfolder. But in a general sense, these two can be considered to be the same. Project = Repository
关于 git 词汇,项目是实际内容(文件)所在的文件夹。而Repository (repo)是 git 保存项目文件夹中每次更改记录的文件夹。但从一般意义上来说,这两者可以认为是相同的。 项目 = 存储库
回答by lake
This is my personal understanding about the topic.
这是我个人对这个话题的理解。
For a project, we can do the version control by different repositories. And for a repository, it can manage a whole project or part of projects.
对于一个项目,我们可以通过不同的仓库进行版本控制。而对于存储库,它可以管理整个项目或部分项目。
Regarding on your project (several prototype applications which are independent of each them). You can manage the project by one repository or by several repositories, the difference:
关于您的项目(几个独立于它们的原型应用程序)。您可以通过一个存储库或多个存储库来管理项目,区别在于:
Manage by one repository. If one of the applications is changed, the whole project (all the applications) will be committed to a new version.
Manage by several repositories. If one application is changed, it will only affect the repository which manages the application. Version for other repositories was not changed.
由一个存储库管理。如果其中一个应用程序发生更改,则整个项目(所有应用程序)都将提交到新版本。
由多个存储库管理。如果更改了一个应用程序,它只会影响管理该应用程序的存储库。其他存储库的版本未更改。