Git如何进行分布式源代码管理?

发布于 2024-08-24 03:25:51 字数 348 浏览 9 评论 0原文

我是一位具有 UNIX SCCS 和 Microsoft Visual SourceSafe 经验的 Git 新手。我刚刚学习 Git,它似乎有一个巨大而痛苦的学习曲线。我已经看到 Git 删除了所有我未提交的数据文件,这让我很担心。 (实用程序如何在没有警告的情况下删除数据文件超出了我的范围)。

Linus Torvalds 在他的 Git 视频中声称 Git 是分布式的,宣扬了分布式的好处,但除了每个人都拥有源代码的副本(克隆)之外,并没有真正解释分布式是如何工作的。

Git 如何帮助分发? Git 如何帮助恢复丢失的文件? Git 分发是如何工作的? 我可以找到文件分发的位置吗? 有 Git 分发教程吗?

提前致谢!

I am a Git newbee with UNIX SCCS and Microsoft Visual SourceSafe experience. I’m just learning Git and it seems to have a huge and painful learning curve. I’ve already seen Git blow away all the data files I hadn’t committed, which concerns me. (How a utility can delete data files without warning is beyond me).

Linus Torvalds, in his video on Git, claims that Git is distributed, touts the benefits of distribution, but other than everyone having a copy (clone) of the source, doesn’t really explain how distribution works.

How does Git help distribution?
How does Git help recover lost files?
How does Git distribution work?
Can I find where files have been distributed?
Is there a Git distribution tutorial?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

┊风居住的梦幻卍 2024-08-31 03:25:51

阅读此内容: http://newartisans.com/2008/04/ git-from-the-bottom-up/


至于你的其他问题:

Git 是如何工作的?

这不是一个足够具体的问题,无法回答。但一般来说,Git 的工作方式是创建对象并将它们放入树中。这些对象对应于您对内容所做的更改。树本身就是物体。 Git 跟踪的是对存储库中内容所做的更改。

分发是如何工作的?

因为所有存储库都可以是服务器,所以不同的存储库可以比较它们的树和对象,并确定该存储库的当前状态与另一个存储库之间的变化。因此,他们能够从其他存储库推送/拉取。

它有什么帮助?

如果您看不出它对您有什么帮助,请坚持使用 MVSS。


我觉得可能是词汇量有问题。配送不是运送。 Git 的分布意味着每个存储库都是一个服务器。这并不意味着它将跟踪它被克隆的位置(尽管您自己的存储库可以保留从中提取/推送到的远程存储库的列表)。

阅读我链接的 PDF。然后按照他们的指示创建一个 github 存储库。 Fork 别人的存储库,任何人,只是为了看看它是如何工作的。

Read this : http://newartisans.com/2008/04/git-from-the-bottom-up/


As for your other questions :

How does Git work ?

This is not a question specific enough to be answered. But generally, Git works by creating objects and putting them in a tree. The objects correspond to changes you have made to your content. Trees are objects themselves. What Git tracks is the changes made to the content in the repository.

How does distribution work?

Because all repositories can be servers, different repositories can compare their trees and objects, and determine what the changes are between such repository's current state and another. Thus, they are able to push to/pull from other repositories.

How does it help?

If you don't see how it can help you, stick with MVSS.


I think there might be a vocabulary problem. Distribution is not shipping. Git's distribution means every repository is a server. It doesn't mean it will keep track of where it has been cloned (although your own repository can keep a list of remote repositories from which to pull from / push to).

Read the PDF I made a link to. Then create a github repository by following their indications. Fork someone else's repository, anyone, just to see how it works.

揪着可爱 2024-08-31 03:25:51

Git 和 Mercurial 在处理 SCM 的分布式特性方面都遵循非常相似的模式。我无法谈论好的 Git 教程,但 Mercurial 上有一些很棒的作品。

了解 Mercurial - 这提供了关于您所问的确切问题的良好信息...这意味着要分发它?

Mercurial Book - 用于更深入的调查。

Git and Mercurial both follow very similar patterns on dealing with the distributed nature of the SCM. I can't speak to good Git tutorials, but there are some great works out there on Mercurial.

Understanding Mercurial - This has good information on the exact question you're asking... what does it mean for it to be distributed?

Mercurial Book - For more in-depth investigations.

⊕婉儿 2024-08-31 03:25:51

Git 和其他 DVCS 基本上将整个存储库“带”给用户。当我有 git 工作副本时,我的硬盘上本地也有整个存储库。其他人无法访问它,但我可以通过 git 系统提供的各种工具和方法共享它。

其他系统,例如 SVN(Linus 在视频中提到),将整个存储库放在单个服务器上。每个人都从该服务器推送和拉取。

再次查看 git,我的提交被隔离到我的计算机上。当我准备好让其他人拥有它们时,我就会以某种方式“发布”我的添加内容——也许是在 SVN 这样的中央服务器上,但这只是一种选择。我可以通过电子邮件将我的更改发送给您。

防止数据丢失

防止数据丢失的一个观点是,如果我有整个存储库的副本,而您也有整个存储库的副本,如果我们中的任何一个丢失了硬盘驱动器,我们可以重新克隆该存储库。存储库。当然,这是假设我们正在交流进展并朝着共同目标努力。

与 SVN(或其他中央存储库)相比,如果您丢失了服务器硬盘,则必须从上次备份中恢复存储库如果您有备份。这意味着需要有人管理服务器并确保备份正在运行等。DVCS 在某种程度上本质上就是这样做的。

当然,还会因意外删除文件等错误而导致“数据丢失”,但这适用于所有 VCS。

Git, and other DVCS, basically "bring" the entire repository to the user. When I have a git working copy, I also have the entire reposotory locally on my hard disk. No one else has access to it but I can share it via various tools amd methods provided by the git system.

Other systems, such as SVN (which Linus mentions in the video), has the entire repository on a single server. Everyone pushes and pulls from that server.

Again, looking at git, my commits are isolated to my computer. When I'm ready for others to have them, I then "publish" my additions in some fashion -- perhaps on a central server like SVN but that is only one option. I could email you my changes.

Prevention of Data Loss

One perspective of the prevention of loss of data, is that if I have a copy of the entire repository and you have a copy of then entire repository, if either of us loose our hard drive, we can re-clone the repository. Of course, this assumes we are exchanging our progress and working towards a common goal.

Compare this to SVN (or other central repos), if you lose the servers hard drive, you have to restore the repo from the last back up if you have a backup. This would mean someone needs to manage the server and ensure backups are running etc. DVCS, in a way, do this inherently.

Of course, there is also the "loss of data" from such mistakes such as accidental file deletes, but that applies to all VCS.

别想她 2024-08-31 03:25:51

您可能换到了不同的分支。运行 gitbranch 来查看您有哪些分支,然后运行 ​​git co <​​branchname>。

就我个人而言,我真的很讨厌 git。巨大的学习曲线和奇怪的命令行界面。但它是目前的首选冷却剂。所以享受吧!哦,是的,不要学习 VSS,除非你也学过,否则你会学到非常非常坏的习惯。 VSS 是源代码控制不应该有的一切。

You probably changed to a different branch. Run git branch to see what branches you have, then git co <branchname>.

Personally I really hate git. Big learning curve and a wierd command line interface. But it is the coolaid of choice right now. So enjoy! Oh yeah, don't learn VSS unless you have too, you will learn REALLY REALLY Bad habits. VSS is everything source control shouldn't be.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文