Skip to content

Commit ac242bd

Browse files
Document usage as a git-driver in README
Co-Authored-By: Chris Simpkins <git.simpkins@gmail.com>
1 parent c551498 commit ac242bd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 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,30 @@ $ 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 how to run the tool. 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 user level. Assuming `fdiff` is available in your path, this setting should do the trick:
112+
113+
git config --global diff.fdiff.command 'fdiff -c --git'
114+
115+
This will write it to your `$HOME/.gitconfig` file looking like this:
116+
117+
```gitconfig
118+
[diff "fdiff"]
119+
command = fdiff -c --git
120+
```
121+
122+
Of course you may also edit it there.
123+
124+
2. Tell Git to 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:
125+
126+
```gitattributes
127+
.otf diff=fdiff
128+
.ttf diff=fdiff
129+
```
130+
106131
### Options
107132

108133
#### Color diffs

0 commit comments

Comments
 (0)