Git 和 Stash 是什么关系?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32294534/
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-09 03:32:12  来源:igfitidea点击:

What is the relationship between Git and Stash?

gitbitbucket-server

提问by Vinee-the-Pooh

I can access my company Stash project repositories. I cloned the project into my local Git repository through Eclipse IDE. For that, I installed required Git plugins into Eclipse.

我可以访问我公司的 Stash 项目存储库。我通过 Eclipse IDE 将项目克隆到我的本地 Git 存储库中。为此,我在 Eclipse 中安装了所需的 Git 插件。

My questions are:

我的问题是:

  • Git is just a facilitator to communicate with Stash?
  • Can't we use Git as distributed repository instead of Stash?
  • What is the relationship between those two tools?
  • Without Git, can the code be cloned, committed to Stash? Or, without Git, can Stash exist?
  • Git 只是与 Stash 沟通的促进者?
  • 我们不能使用 Git 作为分布式存储库而不是 Stash 吗?
  • 这两个工具之间有什么关系?
  • 如果没有 Git,是否可以将代码克隆并提交到 Stash?或者,没有 Git,Stash 可以存在吗?

回答by wasabi

Some brief information about Stash and Git.

关于 Stash 和 Git 的一些简要信息。

Git is a distributed version control system.

Git 是一个分布式版本控制系统。

Stash is a repository management system of Atlassian. It can be used to manage Git repositories, also it can be used to manage repositories of other version control system like mercurial.

Stash 是 Atlassian 的一个仓库管理系统。它可用于管理 Git 存储库,也可用于管理其他版本控制系统(如 mercurial)的存储库。

A good overview for each product can be found in their official sites;

在他们的官方网站上可以找到每个产品的一个很好的概述;

Git official site, about page

Git官网,关于页面

Atlassian official site. In September 2015, Atlassian renamed their Stash product to Bitbucket Server.

Atlassian 官方网站。 2015 年 9 月,Atlassian 将他们的 Stash 产品更名为 Bitbucket Server。

There are many repository management system you can use with Git. One of the most popular is Stash in Enterprise world. But when you look to open source world, GitHub is the most popular one as far as I know.

有许多存储库管理系统可以与 Git 一起使用。最受欢迎的一种是企业界的 Stash。但是当你放眼开源世界时,据我所知,GitHub 是最受欢迎的。

You can create repository, push, or pull your code into Git repositories whether they are in your local computer or they are in remote corporate servers. Using a repository management system ( like Stash) for this kind of task is not necessary, but It is sometimes preferred, especially by the companies which has huge It departments.

您可以创建存储库、推送或拉取您的代码到 Git 存储库中,无论它们是在您的本地计算机中还是位于远程公司服务器中。使用存储库管理系统(如 Stash)来完成此类任务不是必需的,但有时它是首选,尤其是拥有庞大 IT 部门的公司。

So, Git, and Stash are not alternative but complementary to each other. You can think Git as a kernel and stash as the shell surrounding the kernel.

所以,Git 和 Stash 不是替代品,而是互补的。您可以将 Git 视为内核,将 stash 视为围绕内核的外壳。

But, why we need repository management systems;

但是,为什么我们需要存储库管理系统;

  1. Security; huge corporates wants to manage who can access which projects source file with what restrictions. Git can not handle this, it is just VCS.
  2. Administration; You can integrate with corporate LDAP system, You can manage user easier.
  3. Integration; You may have Jira for issue tracking, bamboo as build server and confuluence as wiki. And you can easily integrate them because all of them Atlassian's tools.
  4. Ease of use
  1. 安全; 大型企业想要管理谁可以访问哪些项目的源文件有哪些限制。Git 不能处理这个,它只是 VCS。
  2. 行政; 您可以与企业 LDAP 系统集成,您可以更轻松地管理用户。
  3. 一体化; 您可能使用 Jira 进行问题跟踪,使用bamboo 作为构建服务器,使用 confuluence 作为 wiki。您可以轻松集成它们,因为它们都是 Atlassian 的工具。
  4. 便于使用

Now, Lets try to answer your questions;

现在,让我们试着回答你的问题;

I can access my company Stash project repositories. I cloned the project into my local Git repository

我可以访问我公司的 Stash 项目存储库。我将项目克隆到本地 Git 存储库中

Whether Code repository is on remote server behind stash or it is in local computer. It is a Git repository.

代码存储库是在 stash 后面的远程服务器上还是在本地计算机上。它是一个 Git 存储库。

Git is just a facilitator to communicate with Stash?

Git 只是与 Stash 沟通的促进者?

No, Vice versa is more correct. Git is the core of VCS, you use stash to make it more manageable, secure, and easy to use in your corporate.

不,反之亦然更正确。Git 是 VCS 的核心,您可以使用 stash 使其在公司中更易于管理、安全和易于使用。

Can't we use Git as distributed repository instead of Stash?

我们不能使用 Git 作为分布式存储库而不是 Stash 吗?

First you can not use Git instead of Stash, because they are not alternative to each other. But they are complement to each other.

首先你不能用 Git 代替 Stash,因为它们不能相互替代。但它们是相辅相成的。

If you mean using Git as remote repository, sure you can use it.

如果您的意思是使用 Git 作为远程存储库,请确保您可以使用它。

For clarification, Git is distributed not because you can have remote repositories. Whether centralized or distributed, you can have remote repository on all VCS. Distributed means, when you clone a repository, you also clone all history etc. In this structure, you can have a central repository but it is not required. If centrol repository get corrupted, it is not a big deal, any node can become new central repository. Even though in corporate world having a central repository is best practice, some open source projects ( for instance Linux kernel) don't have a central repository.

为了澄清起见,分发 Git 并不是因为您可以拥有远程存储库。无论是集中式还是分布式,您都可以在所有 VCS 上拥有远程存储库。分布式意味着,当你克隆一个仓库时,你也克隆了所有的历史等等。在这个结构中,你可以有一个中央仓库,但不是必需的。如果中央存储库损坏,这不是什么大问题,任何节点都可以成为新的中央存储库。尽管在企业界拥有中央存储库是最佳实践,但一些开源项目(例如 Linux 内核)没有中央存储库。

What is the relationship between those two tools?

这两个工具之间有什么关系?

I think it is already explained above. They are complementary to each other. Git is the VCS, and stash is repository management tool. It makes Git more secure and manageable for corporate IT departments.

我想上面已经解释过了。它们是相辅相成的。Git 是 VCS,而 stash 是存储库管理工具。它使企业 IT 部门的 Git 更加安全和易于管理。

Without Git, can the code be cloned, committed to Stash? Or, without Git, can Stash exist?

如果没有 Git,是否可以将代码克隆并提交到 Stash?或者,没有 Git,Stash 可以存在吗?

It is already explained as well. You can use Stash with other VCS. Git is not necessary. But you need at least one VCS.

也已经说明了。您可以将 Stash 与其他 VCS 一起使用。Git不是必需的。但是您至少需要一个 VCS。

You can not commit/clone code to/from stash. You can commit/clone code to/from VCS via stash.

您不能向/从 stash 提交/克隆代码。您可以通过 stash 向/从 VCS 提交/克隆代码。

VCS: Version Control System

VCS:版本控制系统

回答by Marcus Müller

Git is just a facilitator to communicate with Stash?

Git 只是与 Stash 沟通的促进者?

No. Git is a very popular, and impressively versatile code revision system, distributed collaboration tool, code archiver, patch manager etc. See git-scm.org.

不。Git 是一个非常流行且令人印象深刻的多功能代码修订系统、分布式协作工具、代码存档器、补丁管理器等。请参阅git-scm.org

Atlassian Stash is management tool for Git.

Atlassian Stash 是Git 的管理工具

Can't we use Git as distributed repository instead of Stash?

我们不能使用 Git 作为分布式存储库而不是 Stash 吗?

You probably can, but that's up to why you use Stash. Stash is supposedto make your life easier as soon as you have multiple collaborators and repos to worry about.

您可能可以,但这取决于您使用 Stash 的原因。一旦您有多个合作者和存储库需要担心,Stash应该会让您的生活更轻松。

What is the relationship between those two tools?

这两个工具之间有什么关系?

Answered above.

以上回答。

Without Git, can the code be cloned, committed to Stash? Or, without Git, can Stash exist?

如果没有 Git,是否可以将代码克隆并提交到 Stash?或者,没有 Git,Stash 可以存在吗?

Nope.

不。

Basically, reading the introductory documentation pages of Stash would have answered this. I wonder why you didn't do that. I still urge you to do it; you'll learn interesting things!

基本上,阅读 Stash 的介绍性文档页面就会回答这个问题。我想知道你为什么不这样做。我仍然敦促你这样做;你会学到有趣的东西!