Skip to content

Commit 63cab3d

Browse files
committed
Merge pull request #289 from oldsharp/pull/08-customizing-git-attributes-fix
Update 08-customizing-git attributes.asc
2 parents f8ba1ac + c7783d9 commit 63cab3d

File tree

1 file changed

+11
-28
lines changed

1 file changed

+11
-28
lines changed

book/08-customizing-git/sections/attributes.asc

+11-28
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ test/ export-ignore
280280

281281
===== `export-subst`
282282

283-
在导出文件进行部署的时候,你可以使用 `git log` 的格式化和关键字展开的处理,来选择被 `export-subst` 属性标记的部分文件。
283+
在导出文件进行部署的时候,你可以将 `git log` 的格式化和关键字展开处理应用于被
284+
`export-subst` 属性标记的部分文件。
284285

285286
举个例子,如果你想在项目中包含一个叫做 `LAST_COMMIT` 的文件,并在运行 `git archive` 的时候自动向它注入最新提交的元数据,可以像这样设置该文件:
286287

@@ -292,7 +293,6 @@ $ git add LAST_COMMIT .gitattributes
292293
$ git commit -am 'adding LAST_COMMIT file for archives'
293294
----
294295

295-
When you run `git archive`, the contents of the archived file will look like this:
296296
运行 `git archive` 之后,该文件被归档后的内容会被替换成这样:
297297

298298
[source,console]
@@ -302,43 +302,26 @@ $ cat ../deployment-testing/LAST_COMMIT
302302
Last commit date: Tue Apr 21 08:38:48 2009 -0700 by Scott Chacon
303303
----
304304

305-
The substitutions can include for example the commit message and any git notes, and git log can do simple word wrapping:
306-
你也可以用诸如提交信息和其它 Git 记录进行替换,还可以应用 `git log` 风格的格式做简单的字词处理:
305+
你也可以用诸如提交信息或者任意的 git 注解进行替换,并且 git log 还能做简单的字词包装:
307306

308307
[source.console]
309308
----
310309
$ echo '$Format:Last commit: %h by %aN at %cd%n%+w(76,6,9)%B$' > LAST_COMMIT
311-
$ git commit -am 'export-subst uses git log's custom formatter
310+
$ git commit -am 'export-subst 使用 git log 的自定义格式化工具
312311
313-
git archive uses git log's `pretty=format:` processor
314-
directly, and strips the surrounding `$Format:` and `$`
315-
markup from the output.
312+
git archive 直接使用 git log`pretty=format:`
313+
处理器,并在输出中移除两侧的 `$Format:` `$`
314+
标记。
316315
'
317316
$ git archive @ | tar xfO - LAST_COMMIT
318317
Last commit: 312ccc8 by Jim Hill at Fri May 8 09:14:04 2015 -0700
319-
export-subst uses git log's custom formatter
318+
export-subst 使用 git log 的自定义格式化工具
320319
321-
git archive uses git log's `pretty=format:` processor directly, and
322-
strips the surrounding `$Format:` and `$` markup from the output.
323-
----
324-
[source.console]
325-
----
326-
$ echo '$Format:Last commit: %h by %aN at %cd%n%+w(76,6,9)%B$' > LAST_COMMIT
327-
$ git commit -am 'export-subst uses git log's custom formatter
328-
329-
git archive uses git log's `pretty=format:` processor
330-
directly, and strips the surrounding `$Format:` and `$`
331-
markup from the output.
332-
'
333-
$ git archive @ | tar xfO - LAST_COMMIT
334-
Last commit: 312ccc8 by Jim Hill at Fri May 8 09:14:04 2015 -0700
335-
export-subst uses git log's custom formatter
336-
337-
git archive uses git log's `pretty=format:` processor directly, and
338-
strips the surrounding `$Format:` and `$` markup from the output.
320+
git archive 直接使用 git log 的 `pretty=format:` 处理器,并
321+
在输出中移除两侧的 `$Format:` 和 `$` 标记。
339322
----
340323

341-
当前归档适用于当前的部署,但是不应该混用到以后的部署中。对 `export-subst` 的应用让我们可以避免这一点
324+
由此得到的归档适用于(当前的)部署工作。然而和其他的导出归档一样,它并不适用于后继的部署工作
342325

343326
==== 合并策略
344327

0 commit comments

Comments
 (0)