Skip to content

Commit 0c9152a

Browse files
authored
Merge branch 'progit:master' into master
2 parents a62daac + 73d0e36 commit 0c9152a

File tree

13 files changed

+119
-41
lines changed

13 files changed

+119
-41
lines changed

.github/workflows/pr-build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Pull Request Build
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Download bootstrap file
14+
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
15+
- name: Run bootstrap
16+
run: sh bootstrap.sh
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: 2.7
21+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
22+
23+
- name: Build book
24+
run: bundle exec rake book:build_action
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release on push to main
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: get bootstrap file
15+
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
16+
- name: run bootstrap
17+
run: sh bootstrap.sh
18+
- name: Compute tag name
19+
id: compute-tag
20+
run: |
21+
echo Computing next tag number
22+
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
23+
PATCH=$(($LASTPATCH+1))
24+
echo "::set-output name=tagname::2.1.${PATCH}"
25+
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: 2.7
31+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
32+
33+
- name: Build release assets
34+
run: bundle exec rake book:build_action
35+
36+
- name: Create release
37+
uses: ncipollo/release-action@v1
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
tag: ${{ steps.compute-tag.outputs.tagname }}
41+
commit: ${{ steps.compute-tag.outputs.branch }}
42+
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'

book/01-introduction/sections/first-time-setup.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ $ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -m
7777
====
7878
Vim、Emacs 和 Notepad++ 都是流行的文本编辑器,通常程序员们会在 Linux 和 macOS
7979
这类基于 Unix 的系统或 Windows 系统上使用它们。
80-
如果你在使用其他的或 32 版本的编辑器,请在 <<C-git-commands#_core_editor>>
80+
如果你在使用其他的或 32 位版本的编辑器,请在 <<C-git-commands#_core_editor>>
8181
中查看设置为该编辑器的具体步骤。
8282
====
8383

book/02-git-basics/sections/recording-changes.asc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== 记录每次更新到仓库
22

33
现在我们的机器上有了一个 *真实项目* 的 Git 仓库,并从这个仓库中检出了所有文件的 *工作副本*
4-
通常,你会对这些文件做些修改,每当完成了一个阶段的目标,想要将记录下它时,就将它提交到到仓库
4+
通常,你会对这些文件做些修改,每当完成了一个阶段的目标,想要将记录下它时,就将它提交到仓库
55

66
请记住,你工作目录下的每一个文件都不外乎这两种状态:*已跟踪**未跟踪*
77
已跟踪的文件是指那些被纳入了版本控制的文件,在上一次快照中有它们的记录,在工作一段时间后,
@@ -626,5 +626,6 @@ $ git add README
626626
----
627627

628628
如此分开操作,Git 也会意识到这是一次重命名,所以不管何种方式结果都一样。
629-
两者唯一的区别是,`mv` 是一条命令而非三条命令,直接用 `git mv` 方便得多。
630-
不过有时候用其他工具批处理重命名的话,要记得在提交前删除旧的文件名,再添加新的文件名。
629+
两者唯一的区别在于,`git mv` 是一条命令而非三条命令,直接使用 `git mv` 方便得多。
630+
不过在使用其他工具重命名文件时,记得在提交前 `git rm` 删除旧文件名,再 `git add`
631+
添加新文件名。

book/02-git-basics/sections/undoing.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $ git commit --amend
3434

3535
[NOTE]
3636
====
37-
当你在修补最后的提交时,并不是通过用改进后的提交 *原位替换* 掉旧有提交的方式来修复的
37+
当你在修补最后的提交时,与其说是修复旧提交,倒不如说是完全用一个 *新的提交* 替换旧的提交
3838
理解这一点非常重要。从效果上来说,就像是旧有的提交从未存在过一样,它并不会出现在仓库的历史中。
3939
4040
修补提交最明显的价值是可以稍微改进你最后的提交,而不会让“啊,忘了添加一个文件”或者

book/02-git-basics/sections/viewing-history.asc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ $ git log --since=2.weeks
246246

247247
[NOTE]
248248
====
249-
你可以指定多个 `--author` 和 `--grep` 搜索条件,这样会只输出 *任意* 匹配
250-
`--author` 模式和 `--grep` 模式的提交。然而,如果你添加了 `--all-match` 选项,
251-
则只会输出 *所有* 匹配 `--grep` 模式的提交。
249+
你可以指定多个 `--author` 和 `--grep` 搜索条件,这样会只输出匹配 *任意*
250+
`--author` 模式和 *任意* `--grep` 模式的提交。然而,如果你添加了 `--all-match` 选项,
251+
则只会输出匹配 *所有* `--grep` 模式的提交。
252252
====
253253

254254
另一个非常有用的过滤器是 `-S`(俗称“pickaxe”选项,取“用鹤嘴锄在土里捡石头”之意),

book/04-git-server/sections/gitlab.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ web 用户界面提供了几个有用的获取版本库信息的网页。
119119
==== 一起工作
120120

121121
在一个 GitLab 项目上一起工作的最简单方法就是赋予协作者对 git 版本库的直接 push 权限。
122-
你可以通过项目设定的 “Members(成员)” 部分向一个项目添加写作者
122+
你可以通过项目设定的 “Members(成员)” 部分向一个项目添加协作者
123123
并且将这个新的协作者与一个访问级别关联(不同的访问级别在 <<_gitlab_groups_section>> 中已简单讨论)。
124124
通过赋予一个协作者 “Developer(开发者)” 或者更高的访问级别,
125125
这个用户就可以毫无约束地直接向版本库或者向分支进行提交。

book/10-git-internals/sections/transfer-protocols.asc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,17 @@ $ ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
175175
这里的全为 '0' 的 SHA-1 值表示之前没有过这个引用——因为你正要添加新的 experiment 引用。
176176
删除引用时,将会看到相反的情况:右边的 SHA-1 值全为 '0'。
177177

178+
然后,客户端会发送一个包含了所有服务端上所没有的对象的包文件。
179+
最终,服务端会响应一个成功(或失败)的标识。
180+
181+
[source]
182+
----
183+
000eunpack ok
184+
----
185+
186+
====== HTTP(S)
187+
188+
上传过程在 HTTP 上几乎是相同的,除了握手阶段有一点小区别。
178189
连接是从下面这个请求开始的:
179190

180191
[source]
@@ -198,6 +209,8 @@ $ ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
198209
这个 `POST` 请求的内容是 `send-pack` 的输出和相应的包文件。
199210
服务端在收到请求后相应地作出成功或失败的 HTTP 响应。
200211

212+
请牢记,HTTP 协议有可能会进一步用分块传输编码将数据包裹起来。
213+
201214
===== 下载数据
202215

203216
(((git commands, fetch-pack)))(((git commands, upload-pack)))

book/A-git-in-other-environments/sections/powershell.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ image::images/posh-git.png[附带了 Posh-Git 扩展包的 Powershell]
3232
===== PowerShell Gallery
3333
如果你有 PowerShell 5 以上或安装了 PackageManagement 的 PowerShell 4,那么可以用包管理器来安装 posh-git。
3434

35-
有关 PowerShell Gallery 的更多详情: https://docs.microsoft.com/en-us/powershell/gallery/overview[]
35+
有关 PowerShell Gallery 的更多详情: https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview[]
3636
[source,powershell]
3737
-----
3838
> Install-Module posh-git -Scope CurrentUser -Force

book/A-git-in-other-environments/sections/sublimetext.asc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* 在状态栏,你能够查看当前所在分支以及你做了多少修改。
1111
* 对一个文件的所有改动都会通过行号槽上的记号显示出来。
1212
* 你能够在 Sublime Text 内使用 Sublime Merge 这个 Git 客户端的部分功能。(要求安装 Sublime Merge:
13-
https://www.sublimemerge.com/)
13+
https://www.sublimemerge.com/
1414
1515
1616
Sublime Text 的官方文档请访问:
17-
https://www.sublimetext.com/docs/3/git_integration.html 。
17+
https://www.sublimetext.com/docs/3/git_integration.html 。

0 commit comments

Comments
 (0)