这些词在Git中意味着什么:存储库,分支,分支,克隆,跟踪? [英] What do these words mean in Git: Repository, fork, branch, clone, track?

查看:198
本文介绍了这些词在Git中意味着什么:存储库,分支,分支,克隆,跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

老实说,我不清楚这里的语义。它们都是关于代码+历史单元的副本/变体,但过去我不确定我可以说。这个逻辑结构是在什么地方解释的?

解决方案

存储库只是存储工作历史的地方。它通常位于工作副本的 .git 子目录中 - 您正在处理的文件的最新状态的副本。



要分派一个项目(在特定时间点从某人的仓库获取源代码,并对其应用自己的分歧更改),可以克隆远程仓库以创建它的副本,然后执行自己在本地仓库中工作,并提交更改。



在存储库中您有分支,这些分支在您自己的存储库中是有效的分支。您的分支将在您的存储库中有一个祖先提交,并将与您的更改分开。您可以稍后合并您的分支更改。分支可让您一次处理多个不同的功能。

您还可以跟踪远程存储库中的各个分支。这允许您从其他人的分支中引入更改并将其合并到您自己的分支中。如果你和一个朋友一起工作一个新功能,这可能会很有用。



在线有很多很棒的git书籍。查看 ProGit Git Magic 开始,以及官方教程和社区书。

I'm honestly not clear on the semantics here. They're all about copies/variants of a code+history unit, but past that I'm not sure I could say. Is this logical structure explained somewhere?

解决方案

A repository is simply a place where the history of your work is stored. It often lives in a .git subdirectory of your working copy - a copy of the most recent state of the files you're working on.

To fork a project (take the source from someone's repository at certain point in time, and apply your own diverging changes to it), you would clone the remote repository to create a copy of it, then do your own work in your local repository and commit changes.

Within a repository you have branches, which are effectively forks within your own repository. Your branches will have an ancestor commit in your repository, and will diverge from that commit with your changes. You can later merge your branch changes. Branches let you work on multiple disparate features at once.

You can also track individual branches in remote repositories. This allows you to pull in changes from another individual's branches and to merge them into a branch of your own. This may be useful if you and a friend are working on a new feature together.

There are lots of great git books online. Have a look at ProGit and Git Magic to get started, as well as the official tutorials and community book.

这篇关于这些词在Git中意味着什么:存储库,分支,分支,克隆,跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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