Skip to content

Commit db69640

Browse files
committed
Sync 08-customizing-git attributes
1 parent 033181a commit db69640

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Git 属性能很好地解决此问题。
6363
我们现在就来设置它。
6464
我们会对 Git 进行配置,令其能够借助 `docx2txt` 程序将 Word 文档转为可读文本文件,这样不同的文件间就能够正确比较了。
6565

66-
首先,你需要安装 `docx2txt`;它可以从 http://docx2txt.sourceforge.net[] 下载。按照 `INSTALL` 文件的说明,把它放到你的可执行路径下。
66+
首先,你需要安装 `docx2txt`;它可以从 http://docx2txt.sourceforge.net[] 下载。
67+
按照 `INSTALL` 文件的说明,把它放到你的可执行路径下。
6768
接下来,你还需要写一个脚本把输出结果包装成 Git 支持的格式。
6869
在你的可执行路径下创建一个叫 `docx2txt` 文件,添加这些内容:
6970

@@ -105,7 +106,7 @@ index 0b013ca..ba25db5 100644
105106
Many people's version-control method of choice is to copy files into another directory (perhaps a time-stamped directory, if they're clever). This approach is very common because it is so simple, but it is also incredibly error prone. It is easy to forget which directory you're in and accidentally write to the wrong file or copy over files you don't mean to.
106107
----
107108

108-
Git 成功地挑出了我添加的那句话“Testing: 1, 2, 3.”,一字不差。
109+
Git 成功地挑出了我们添加的那句话“Testing: 1, 2, 3.”,一字不差。
109110
还算不上完美——格式上的变动显示不出来——但已经足够了。
110111

111112
你还能用这个方法比较图像文件。
@@ -155,7 +156,7 @@ Git 属性提供了两种方法来达到这一目的。
155156

156157
一种方法是,你可以把文件所对应数据对象的 SHA-1 校验和自动注入到文件中的 `$Id$` 字段。
157158
如果在一个或多个文件上设置了该属性,下次当你检出相关分支的时候,Git 会用相应数据对象的 SHA-1 值替换上述字段。
158-
注意,这不是提交对象的 SHA 校验和,而是数据对象本身的校验和:
159+
注意,这不是提交对象的 SHA-1 校验和,而是数据对象本身的校验和:
159160

160161
[source,console]
161162
----
@@ -279,11 +280,8 @@ test/ export-ignore
279280

280281
===== `export-subst`
281282

282-
When exporting files for deployment you can apply `git log`'s formatting and keyword-expansion processing to selected portions of files marked with the
283-
`export-subst` attribute.
284283
在导出文件进行部署的时候,你可以使用 `git log` 的格式化和关键字展开的处理,来选择被 `export-subst` 属性标记的部分文件。
285284

286-
For instance, if you want to include a file named `LAST_COMMIT` in your project, and have metadata about the last commit automatically injected into it when `git archive` runs, you can for example set up the file like this:
287285
举个例子,如果你想在项目中包含一个叫做 `LAST_COMMIT` 的文件,并在运行 `git archive` 的时候自动向它注入最新提交的元数据,可以像这样设置该文件:
288286

289287
[source,console]
@@ -340,7 +338,6 @@ Last commit: 312ccc8 by Jim Hill at Fri May 8 09:14:04 2015 -0700
340338
strips the surrounding `$Format:` and `$` markup from the output.
341339
----
342340

343-
The resulting archive is suitable for deployment work, but like any exported archive it isn't suitable for further development work.
344341
当前归档适用于当前的部署,但是不应该混用到以后的部署中。对 `export-subst` 的应用让我们可以避免这一点。
345342

346343
==== 合并策略

0 commit comments

Comments
 (0)