Skip to content

Commit

Permalink
Merge pull request #381 from liuxilu/master
Browse files Browse the repository at this point in the history
修正符号+添加缺失
  • Loading branch information
networm authored Aug 4, 2019
2 parents 1d5a79d + 81e66e3 commit 7061576
Show file tree
Hide file tree
Showing 30 changed files with 153 additions and 119 deletions.
34 changes: 34 additions & 0 deletions C-git-commands.asc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,40 @@ Git 做的很多工作都有一个默认方式。

最后,基本上 <<ch08-customizing-git#r_git_config>> 整个章节都是针对此命令的。

[[_core_editor]]
==== git config core.editor 命令

就像 <<ch01-introduction#r_first_time>> 里的设置指示,很多编辑器可以如下设置:

.详细的 `core.editor` 设置命令列表
[cols="1,2",options="header"]
|==============================
|编辑器 | 设置命令
|Atom |`git config --global core.editor "atom --wait"`
|BBEdit (Mac, with command line tools) |`git config --global core.editor "bbedit -w"`
|Emacs |git config --global core.editor emacs
|Gedit (Linux) |`git config --global core.editor "gedit --wait --new-window"`
|Gvim (Windows 64-bit) |`git config --global core.editor "'C:/Program Files/Vim/vim72/gvim.exe' --nofork '%*'"` (Also see note below)
|Kate (Linux) |`git config --global core.editor "kate"`
|nano |`git config --global core.editor "nano -w"`
|Notepad (Windows 64-bit) |`git config core.editor notepad`
|Notepad++ (Windows 64-bit) |git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin" (Also see note below)
|Scratch (Linux)|`git config --global core.editor "scratch-text-editor"`
|Sublime Text (macOS) |`git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"`
|Sublime Text (Windows 64-bit) |`git config --global core.editor "'C:/Program Files/Sublime Text 3/sublime_text.exe' -w"` (Also see note below)
|Textmate |`git config --global core.editor "mate -w"`
|Textpad (Windows 64-bit) |`git config --global core.editor "'C:/Program Files/TextPad 5/TextPad.exe' -m` (Also see note below)
|Vim |`git config --global core.editor "vim"`
|VS Code |`git config --global core.editor "code --wait"`
|WordPad |`git config --global core.editor '"C:\Program Files\Windows NT\Accessories\wordpad.exe"'"`
|Xi | `git config --global core.editor "xi --wait"`
|==============================

[NOTE]
====
如果你在 64 位 Windows 系统上安装了 32 位的文本编辑器,它会被安装在 `C:\Program Files (x86)\` 而不是上面表格所写的 `C:\Program Files\` 。
====

==== git help

`git help` 命令用来显示任何命令的 Git 自带文档。
Expand Down
2 changes: 1 addition & 1 deletion book/01-introduction/sections/basics.asc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Git 仓库目录是 Git 用来保存项目的元数据和对象数据库的地
这些从 Git 仓库的压缩数据库中提取出来的文件,放在磁盘上供你使用或修改。

暂存区域是一个文件,保存了下次将提交的文件列表信息,一般在 Git 仓库目录中。
有时候也被称作``索引'',不过一般说法还是叫暂存区域。
有时候也被称作“索引”,不过一般说法还是叫暂存区域。

基本的 Git 工作流程如下:

Expand Down
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/getting-a-repository.asc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $ git commit -m 'initial project version'
$ git clone https://github.com/libgit2/libgit2
----

这会在当前目录下创建一个名为 ``libgit2'' 的目录,并在这个目录下初始化一个 `.git` 文件夹,从远程仓库拉取下所有数据放入 `.git` 文件夹,然后从中读取最新版本的文件的拷贝。
这会在当前目录下创建一个名为 libgit2 的目录,并在这个目录下初始化一个 `.git` 文件夹,从远程仓库拉取下所有数据放入 `.git` 文件夹,然后从中读取最新版本的文件的拷贝。
如果你进入到这个新建的 `libgit2` 文件夹,你会发现所有的项目文件已经在里面了,准备就绪等待后续的开发和使用。
如果你想在克隆远程仓库的时候,自定义本地仓库的名字,你可以使用如下命令:

Expand Down
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/recording-changes.asc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nothing to commit, working directory clean
这说明你现在的工作目录相当干净。换句话说,所有已跟踪文件在上次提交后都未被更改过。
此外,上面的信息还表明,当前目录下没有出现任何处于未跟踪状态的新文件,否则 Git 会在这里列出来。
最后,该命令还显示了当前所在分支,并告诉你这个分支同远程服务器上对应的分支没有偏离。
现在,分支名是 ``master'',这是默认的分支名。
现在,分支名是 master,这是默认的分支名。
我们在 <<ch03-git-branching#ch03-git-branching>> 会详细讨论分支和引用。

现在,让我们在项目下创建一个新的 README 文件。
Expand Down
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/remotes.asc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ $ git fetch [remote-name]
这个命令会访问远程仓库,从中拉取所有你还没有的数据。
执行完成后,你将会拥有那个远程仓库中所有分支的引用,可以随时合并或查看。

如果你使用 `clone` 命令克隆了一个仓库,命令会自动将其添加为远程仓库并默认以 ``origin'' 为简写。
如果你使用 `clone` 命令克隆了一个仓库,命令会自动将其添加为远程仓库并默认以 origin 为简写。
所以,`git fetch origin` 会抓取克隆(或上一次抓取)后新推送的所有工作。
必须注意 `git fetch` 命令会将数据拉取到你的本地仓库 - 它并不会自动合并或修改你当前的工作。
当准备好时你必须手动将其合并入你的工作。
Expand Down
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/tagging.asc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ a6b4c97498bd301d84096da251c98a07c7723e65 beginning write support
8a5cbc430f1a9c3d00faaeffd07798508422908a updated readme
----

现在,假设在 v1.2 时你忘记给项目打标签,也就是在 ``updated rakefile'' 提交。
现在,假设在 v1.2 时你忘记给项目打标签,也就是在 updated rakefile 提交。
你可以在之后补上标签。
要在那个提交上打标签,你需要在命令的末尾指定提交的校验和(或部分校验和):

Expand Down
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/undoing.asc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Changes to be committed:
modified: CONTRIBUTING.md
----

``Changes to be committed'' 文字正下方,提示使用 `git reset HEAD <file>...` 来取消暂存。
Changes to be committed 文字正下方,提示使用 `git reset HEAD <file>...` 来取消暂存。
所以,我们可以这样来取消暂存 `CONTRIBUTING.md` 文件:

[source,console]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Normal merge conflict for 'index.html':
Hit return to start merge resolution tool (opendiff):
----

如果你想使用除默认工具(在这里 Git 使用 `opendiff` 做为默认的合并工具,因为作者在 Mac 上运行该程序)外的其他合并工具,你可以在 ``下列工具中(one of the following tools)'' 这句后面看到所有支持的合并工具。
如果你想使用除默认工具(在这里 Git 使用 `opendiff` 做为默认的合并工具,因为作者在 Mac 上运行该程序)外的其他合并工具,你可以在 下列工具中(one of the following tools) 这句后面看到所有支持的合并工具。
然后输入你喜欢的工具名字就可以了。

[NOTE]
Expand Down
4 changes: 2 additions & 2 deletions book/03-git-branching/sections/nutshell.asc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Git 的默认分支名字是 `master`。

[NOTE]
====
Git 的 ``master'' 分支并不是一个特殊分支。(((master)))
Git 的 master 分支并不是一个特殊分支。(((master)))
它就跟其它分支完全没有区别。
之所以几乎每一个仓库都有 master 分支,是因为 `git init` 命令默认创建它,并且大多数人都懒得去改动它。
====
Expand Down Expand Up @@ -85,7 +85,7 @@ f30ab (HEAD, master, testing) add feature #32 - ability to add new
98ca9 initial commit of my project
----

正如你所见,当前 ``master''``testing'' 分支均指向校验和以 `f30ab` 开头的提交对象。
正如你所见,当前 mastertesting 分支均指向校验和以 `f30ab` 开头的提交对象。

[[r_switching_branches]]
==== 分支切换
Expand Down
2 changes: 1 addition & 1 deletion book/03-git-branching/sections/rebasing.asc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ image::images/perils-of-rebasing-4.png[你将相同的内容又合并了一次
如果团队中的某人强制推送并覆盖了一些你所基于的提交,你需要做的就是检查你做了哪些修改,以及他们覆盖了哪些修改。

实际上,Git 除了对整个提交计算 SHA-1 校验和以外,也对本次提交所引入的修改计算了校验和——
``patch-id''
patch-id

如果你拉取被覆盖过的更新并将你手头的工作基于此进行变基的话,一般情况下 Git 都能成功分辨出哪些是你的修改,并把它们应用到新分支上。

Expand Down
18 changes: 9 additions & 9 deletions book/03-git-branching/sections/remote-branches.asc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
Git 也会给你一个与 origin 的 `master` 分支在指向同一个地方的本地 `master` 分支,这样你就有工作的基础。

[NOTE]
.``origin'' 并无特殊含义
.origin 并无特殊含义
====
远程仓库名字 ``origin'' 与分支名字 ``master'' 一样,在 Git 中并没有任何特别的含义一样。
同时 ``master'' 是当你运行 `git init` 时默认的起始分支名字,原因仅仅是它的广泛使用,``origin'' 是当你运行 `git clone` 时默认的远程仓库名字。
远程仓库名字 origin 与分支名字 master 一样,在 Git 中并没有任何特别的含义一样。
同时 master 是当你运行 `git init` 时默认的起始分支名字,原因仅仅是它的广泛使用,origin 是当你运行 `git clone` 时默认的远程仓库名字。
如果你运行 `git clone -o booyah`,那么你默认的远程分支名字将会是 `booyah/master`。(((origin)))
====

Expand All @@ -37,7 +37,7 @@ image::images/remote-branches-1.png[克隆之后的服务器与本地仓库。]
image::images/remote-branches-2.png[本地与远程的工作可以分叉。]

如果要同步你的工作,运行 `git fetch origin` 命令。
这个命令查找 ``origin'' 是哪一个服务器(在本例中,它是 `git.ourcompany.com`),从中抓取本地没有的数据,并且更新本地数据库,移动 `origin/master` 指针指向新的、更新后的位置。
这个命令查找 origin 是哪一个服务器(在本例中,它是 `git.ourcompany.com`),从中抓取本地没有的数据,并且更新本地数据库,移动 `origin/master` 指针指向新的、更新后的位置。

.`git fetch` 更新你的远程仓库引用
image::images/remote-branches-3.png[`git fetch` 更新你的远程仓库引用。]
Expand Down Expand Up @@ -80,9 +80,9 @@ To https://github.com/schacon/simplegit
----

这里有些工作被简化了。
Git 自动将 `serverfix` 分支名字展开为 `refs/heads/serverfix:refs/heads/serverfix`,那意味着,``推送本地的 serverfix 分支来更新远程仓库上的 serverfix 分支。''
Git 自动将 `serverfix` 分支名字展开为 `refs/heads/serverfix:refs/heads/serverfix`,那意味着,推送本地的 serverfix 分支来更新远程仓库上的 serverfix 分支。
我们将会详细学习 <<ch10-git-internals#ch10-git-internals>> 的 `refs/heads/` 部分,但是现在可以先把它放在儿。
你也可以运行 `git push origin serverfix:serverfix`,它会做同样的事 - 相当于它说,``推送本地的 serverfix 分支,将其作为远程仓库的 serverfix 分支''
你也可以运行 `git push origin serverfix:serverfix`,它会做同样的事——也就是说“推送本地的 serverfix 分支,将其作为远程仓库的 serverfix 分支
可以通过这种格式来推送本地分支到一个命名不相同的远程分支。
如果并不想让远程仓库上的分支叫做 `serverfix`,可以运行 `git push origin serverfix:awesomebranch` 来将本地的 `serverfix` 分支推送到远程仓库上的 `awesomebranch` 分支。

Expand All @@ -92,7 +92,7 @@ Git 自动将 `serverfix` 分支名字展开为 `refs/heads/serverfix:refs/heads
如果你正在使用 HTTPS URL 来推送,Git 服务器会询问用户名与密码。
默认情况下它会在终端中提示服务器是否允许你进行推送。
如果不想在每一次推送时都输入用户名与密码,你可以设置一个 ``credential cache''
如果不想在每一次推送时都输入用户名与密码,你可以设置一个 credential cache
最简单的方式就是将其保存在内存中几分钟,可以简单地运行 `git config --global credential.helper cache` 来设置它。
想要了解更多关于不同验证缓存的可用选项,查看 <<ch07-git-tools#r_credential_caching>>。
Expand Down Expand Up @@ -130,7 +130,7 @@ Switched to a new branch 'serverfix'
==== 跟踪分支

(((branches, tracking)))(((branches, upstream)))
从一个远程跟踪分支检出一个本地分支会自动创建所谓的 ``跟踪分支''(它跟踪的分支叫做 ``上游分支'')。
从一个远程跟踪分支检出一个本地分支会自动创建所谓的跟踪分支(它跟踪的分支叫做上游分支)。
跟踪分支是与远程分支有直接关系的本地分支。
如果在一个跟踪分支上输入 `git pull`,Git 能自动地识别去哪个服务器上抓取、合并到哪个分支。

Expand Down Expand Up @@ -184,7 +184,7 @@ $ git branch -vv
testing 5ea463a trying something new
----

这里可以看到 `iss53` 分支正在跟踪 `origin/iss53` 并且 ``ahead'' 是 2,意味着本地有两个提交还没有推送到服务器上。
这里可以看到 `iss53` 分支正在跟踪 `origin/iss53` 并且 ahead 是 2,意味着本地有两个提交还没有推送到服务器上。
也能看到 `master` 分支正在跟踪 `origin/master` 分支并且是最新的。
接下来可以看到 `serverfix` 分支正在跟踪 `teamone` 服务器上的 `server-fix-good` 分支并且领先 3 落后 1,意味着服务器上有一次提交还没有合并入同时本地有三次提交还没有推送。
最后看到 `testing` 分支并没有跟踪任何远程分支。
Expand Down
2 changes: 1 addition & 1 deletion book/04-git-server/sections/git-daemon.asc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Git 守护进程

(((serving repositories, git protocol)))
接下来我们将通过 ``Git'' 协议建立一个基于守护进程的仓库。
接下来我们将通过 Git 协议建立一个基于守护进程的仓库。
对于快速且无需授权的 Git 数据访问,这是一个理想之选。
请注意,因为其不包含授权服务,任何通过该协议管理的内容将在其网络上公开。

Expand Down
Loading

0 comments on commit 7061576

Please sign in to comment.