Skip to content

Commit 534eef6

Browse files
Document usage as a git-driver in README
Co-Authored-By: Chris Simpkins <[email protected]>
1 parent c551498 commit 534eef6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Looking for a high-level overview of OpenType table differences rather than low-
3535
- Display the first n lines of the diff output with the `--head` option
3636
- Display the last n lines of the diff output with the `--tail` option
3737
- Execute the diff with an external diff tool using the `--external` option
38+
- Use in Git as a diff-driver to be the default diff tool for fonts
3839

3940
Run `fdiff --help` to view all available options.
4041

@@ -103,6 +104,34 @@ $ fdiff [OPTIONS] [PRE-FONT FILE URL] [POST-FONT FILE FILE PATH]
103104

104105
**Tip**: Remote git repository hosting services (like Github) support access to files on different git branches by URL. Use these repository branch URL to compare fonts across git branches in your repository.
105106

107+
#### As Git's diff driver for fonts
108+
109+
Git can be configured to automatically use a specific tool to diff specific file types. These are the steps to use `fdiff` as the default diff output for font files.
110+
111+
1. Tell Git that the tool is available and how to run it. As with most git configuration options this may be set for a repository (`--local`), for your user (`--global`), or system (`--system`). We recommend setting this at the repository or user level. Assuming `fdiff` is available in your path, this setting should do the trick:
112+
113+
# Repository level
114+
git config --local diff.fdiff.command 'fdiff -c --git'
115+
116+
# User level
117+
git config --global diff.fdiff.command 'fdiff -c --git'
118+
119+
This will write something like the following to either the current repository's `.git/config` or your user's `$HOME/.gitconfig` file looking like this:
120+
121+
```gitconfig
122+
[diff "fdiff"]
123+
command = fdiff -c --git
124+
```
125+
126+
Of course you may also edit the appropriate file and place that configuration manually.
127+
128+
2. Tell Git to actually use that specific tool for supported file types. This may also be done at multiple places. Each repository may have it's own `.gitattributes` file, a user may have one setting global defaults in `$XDG_HOME/git/attributes`, or there may be a system wide default file. Wherever you choose to place this, the lines are the same:
129+
130+
```gitattributes
131+
.otf diff=fdiff
132+
.ttf diff=fdiff
133+
```
134+
106135
### Options
107136

108137
#### Color diffs

0 commit comments

Comments
 (0)