Skip to content

Commit 0723f8b

Browse files
committed
Document usage as a git-driver in README
1 parent 3d6c3f0 commit 0723f8b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Display the first n lines of the diff output with the `--head` option
3434
- Display the last n lines of the diff output with the `--tail` option
3535
- Execute the diff with an external diff tool using the `--external` option
36+
- Use in Git as a diff-driver to be the default diff tool for fonts
3637

3738
Run `fdiff --help` to view all available options.
3839

@@ -101,6 +102,30 @@ $ fdiff [OPTIONS] [PRE-FONT FILE URL] [POST-FONT FILE FILE PATH]
101102

102103
**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.
103104

105+
#### As Git's diff driver for fonts
106+
107+
Git can be configured to automatically use a specific tool to diff specific file types. The are to steps to complete to use `fdiff` as the default diff output for font files.
108+
109+
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:
110+
111+
git config --global diff.fdiff.command 'fdiff -c --git'
112+
113+
This will write it to your `$HOME/.gitconfig` file looking like this:
114+
115+
```gitconfig
116+
[diff "fdiff"]
117+
command = fdiff -c --git
118+
```
119+
120+
Of course you may also edit it there.
121+
122+
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 their may be a system wide default file. Whichever file you choose to place this is, the lines to add are the same:
123+
124+
```gitattributes
125+
.otf diff=fdiff
126+
.ttf diff=fdiff
127+
```
128+
104129
### Options
105130

106131
#### Color diffs

0 commit comments

Comments
 (0)