Skip to content

Commit baef783

Browse files
committed
Merge pull request #59 from oldsharp/pr-chapter-10-section-01
Translate Chapter 10 Section 01
2 parents 40544d7 + bc603f4 commit baef783

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
[[_plumbing_porcelain]]
2-
=== Plumbing and Porcelain
2+
=== 底层命令和高层命令
33

4-
This book covers how to use Git with 30 or so verbs such as `checkout`, `branch`, `remote`, and so on.
5-
But because Git was initially a toolkit for a VCS rather than a full user-friendly VCS, it has a bunch of verbs that do low-level work and were designed to be chained together UNIX style or called from scripts.
6-
These commands are generally referred to as ``plumbing'' commands, and the more user-friendly commands are called ``porcelain'' commands.
4+
本书旨在讨论如何通过 `checkout`、`branch`、`remote` 等大约 30 个诸如此类动词形式的命令来玩转 Git。
5+
然而,由于 Git 最初是一套面向版本控制系统的工具集,而不是一个完整的、用户友好的版本控制系统,所以它还包含了一部分用于完成底层工作的命令。
6+
这些命令被设计成能以 UNIX 命令行的风格连接在一起,抑或藉由脚本调用,来完成工作。
7+
这部分命令一般被称作“底层(plumbing)”命令,而那些更友好的命令则被称作“高层(porcelain)”命令。
78

8-
The book's first nine chapters deal almost exclusively with porcelain commands.
9-
But in this chapter, you'll be dealing mostly with the lower-level plumbing commands, because they give you access to the inner workings of Git, and help demonstrate how and why Git does what it does.
10-
Many of these commands aren't meant to be used manually on the command line, but rather to be used as building blocks for new tools and custom scripts.
9+
本书前九章专注于探讨高层命令。
10+
然而在本章,你将主要面对底层命令。
11+
因为,底层命令得以让你窥探 Git 内部的工作机制,也有助于说明 Git 是如何完成工作的,以及它为何如此运作。
12+
多数底层命令并不面向最终用户:它们更适合作为新命令和自定义脚本的组成部分。
1113

12-
When you run `git init` in a new or existing directory, Git creates the `.git` directory, which is where almost everything that Git stores and manipulates is located.
13-
If you want to back up or clone your repository, copying this single directory elsewhere gives you nearly everything you need.
14-
This entire chapter basically deals with the stuff in this directory.
15-
Here's what it looks like:
14+
当你在一个新目录或已有目录执行 `git init` 时,Git 会创建一个 `.git` 目录。
15+
这个目录包含了几乎所有 Git 存储和操作的对象。
16+
如果你想备份或复制一个版本库,只需把这个目录拷贝至另一处即可。
17+
本章探讨的所有内容,均位于这个目录内。
18+
该目录的结构如下所示:
1619

1720
[source,console]
1821
----
@@ -26,12 +29,13 @@ objects/
2629
refs/
2730
----
2831

29-
You may see some other files in there, but this is a fresh `git init` repository – it's what you see by default.
30-
The `description` file is only used by the GitWeb program, so don't worry about it.
31-
The `config` file contains your project-specific configuration options, and the `info` directory keeps a global exclude file (((excludes))) for ignored patterns that you don't want to track in a .gitignore file.
32-
The `hooks` directory contains your client- or server-side hook scripts, which are discussed in detail in <<_git_hooks>>.
32+
该目录下可能还会包含其他文件,不过对于一个全新的 `git init` 版本库,这将是你看到的默认结构。
33+
`description` 文件仅供 GitWeb 程序使用,我们无需关心。
34+
`config` 文件包含项目特有的配置选项。
35+
`info` 目录包含一个全局性排除(global exclude)文件(((excludes))),用以放置那些不希望被记录在 .gitignore 文件中的忽略模式(ignored patterns)。
36+
`hooks` 目录包含客户端或服务端的钩子脚本(hook scripts),在 <<_git_hooks>> 中这部分话题已被详细探讨过。
3337

34-
This leaves four important entries: the `HEAD` and (yet to be created) `index` files, and the `objects` and `refs` directories.
35-
These are the core parts of Git.
36-
The `objects` directory stores all the content for your database, the `refs` directory stores pointers into commit objects in that data (branches), the `HEAD` file points to the branch you currently have checked out, and the `index` file is where Git stores your staging area information.
37-
You'll now look at each of these sections in detail to see how Git operates.
38+
剩下的四个条目很重要:`HEAD` 文件、(尚待创建的)`index` 文件,和 `objects` 目录、`refs` 目录。
39+
这些条目是 Git 的核心组成部分。
40+
`objects` 目录存储所有数据内容;`refs` 目录存储指向数据(分支)的提交对象的指针;`HEAD` 文件指示目前被检出的分支;`index` 文件保存暂存区信息。
41+
我们将详细地逐一检视这四部分,以期理解 Git 是如何运转的。

status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"sections/maintenance.asc": 0,
103103
"sections/objects.asc": 0,
104104
"sections/packfiles.asc": 0,
105-
"sections/plumbing-porcelain.asc": 0,
105+
"sections/plumbing-porcelain.asc": 100,
106106
"sections/refs.asc": 0,
107107
"sections/refspec.asc": 0,
108108
"sections/transfer-protocols.asc": 0

0 commit comments

Comments
 (0)