@@ -280,7 +280,8 @@ test/ export-ignore
280
280
281
281
===== `export-subst`
282
282
283
- 在导出文件进行部署的时候,你可以使用 `git log` 的格式化和关键字展开的处理,来选择被 `export-subst` 属性标记的部分文件。
283
+ 在导出文件进行部署的时候,你可以将 `git log` 的格式化和关键字展开处理应用于被
284
+ `export-subst` 属性标记的部分文件。
284
285
285
286
举个例子,如果你想在项目中包含一个叫做 `LAST_COMMIT` 的文件,并在运行 `git archive` 的时候自动向它注入最新提交的元数据,可以像这样设置该文件:
286
287
@@ -292,7 +293,6 @@ $ git add LAST_COMMIT .gitattributes
292
293
$ git commit -am 'adding LAST_COMMIT file for archives'
293
294
----
294
295
295
- When you run `git archive`, the contents of the archived file will look like this:
296
296
运行 `git archive` 之后,该文件被归档后的内容会被替换成这样:
297
297
298
298
[source,console]
@@ -302,43 +302,26 @@ $ cat ../deployment-testing/LAST_COMMIT
302
302
Last commit date: Tue Apr 21 08:38:48 2009 -0700 by Scott Chacon
303
303
----
304
304
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 还能做简单的字词包装:
307
306
308
307
[source.console]
309
308
----
310
309
$ 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 的自定义格式化工具
312
311
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
+ 标记。
316
315
'
317
316
$ git archive @ | tar xfO - LAST_COMMIT
318
317
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 的自定义格式化工具
320
319
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:` 和 `$` 标记。
339
322
----
340
323
341
- 当前归档适用于当前的部署,但是不应该混用到以后的部署中。对 `export-subst` 的应用让我们可以避免这一点 。
324
+ 由此得到的归档适用于(当前的)部署工作。然而和其他的导出归档一样,它并不适用于后继的部署工作 。
342
325
343
326
==== 合并策略
344
327
0 commit comments