|
1 |
| -## Pro-tips |
| 1 | +# Pro-tips |
2 | 2 |
|
3 |
| -#### One-off fanciness or a specific diff-so-fancy alias |
| 3 | +## One-off fanciness or a specific diff-so-fancy alias |
4 | 4 |
|
5 | 5 | You can do also do a one-off:
|
| 6 | + |
6 | 7 | ```shell
|
7 | 8 | git diff --color | diff-so-fancy
|
8 | 9 | ```
|
| 10 | + |
9 | 11 | or configure an alias and a corresponding pager to use `diff-so-fancy`:
|
| 12 | + |
10 | 13 | ```shell
|
11 | 14 | git config --global alias.dsf "diff --color"
|
12 | 15 | git config --global pager.dsf "diff-so-fancy | less --tabs=4 -RFXS"
|
13 | 16 | ```
|
14 | 17 |
|
15 |
| -#### Opting-out |
| 18 | +## Opting-out |
16 | 19 |
|
17 | 20 | Sometimes you will want to bypass diff-so-fancy. Use `--no-pager` for that:
|
18 | 21 |
|
19 | 22 | ```shell
|
20 | 23 | git --no-pager diff
|
21 | 24 | ```
|
22 | 25 |
|
23 |
| -#### Raw patches |
| 26 | +## Raw patches |
24 | 27 |
|
25 | 28 | As a shortcut for a 'normal' diff to save as a patch for emailing or later
|
26 | 29 | application, it may be helpful to configure an alias:
|
| 30 | + |
27 | 31 | ```ini
|
28 | 32 | [alias]
|
29 | 33 | patch = !git --no-pager diff --no-color
|
30 | 34 | ```
|
| 35 | + |
31 | 36 | which can then be used as `git patch > changes.patch`.
|
32 | 37 |
|
33 | 38 | #### Moving around in the diff
|
34 | 39 |
|
35 |
| -You can pre-seed your `less` pager with a search pattern, so you can move |
| 40 | +You can pre-seed your `less` pager with a search pattern so that you can move |
36 | 41 | between files with `n`/`N` keys:
|
| 42 | + |
37 | 43 | ```ini
|
38 | 44 | [pager]
|
39 | 45 | diff = diff-so-fancy | less --tabs=4 -RFXS --pattern '^(Date|added|deleted|modified): '
|
40 | 46 | ```
|
41 | 47 |
|
42 |
| -#### Zsh plugin providing diff-so-fancy |
| 48 | +## Zsh plugin providing diff-so-fancy |
43 | 49 |
|
44 |
| -Zsh plugin [zdharma/zsh-diff-so-fancy](https://github.com/zdharma/zsh-diff-so-fancy) has this |
45 |
| -project as a submodule so installing the plugin installs `diff-so-fancy`. The plugin provides |
46 |
| -subcommand `git dsf` out of the box. Installation with Zinit, Zplug and Zgen: |
| 50 | +Zsh plugin [zdharma-continuum/zsh-diff-so-fancy](https://github.com/zdharma-continuum/zsh-diff-so-fancy) has this |
| 51 | +project as a submodule, so installing the plugin installs `diff-so-fancy`. The plugin provides |
| 52 | +the subcommand `git dsf` out of the box. Installation with Zinit, Zplug, and Zgen: |
47 | 53 |
|
48 | 54 | ```zsh
|
49 | 55 | # zinit
|
50 | 56 | zinit ice lucid as"program" pick"bin/git-dsf"
|
51 |
| -zinit load zdharma/zsh-diff-so-fancy |
| 57 | +zinit load zdharma-continuum/zsh-diff-so-fancy |
52 | 58 |
|
53 |
| -# Or zplug |
54 |
| -zplug "zdharma/zsh-diff-so-fancy", as:command, use:bin/git-dsf |
| 59 | +# zplug |
| 60 | +zplug "zdharma-continuum/zsh-diff-so-fancy", as:command, use:bin/git-dsf |
55 | 61 |
|
56 |
| -# Or zgen and others |
57 |
| -zgen zdharma/zsh-diff-so-fancy |
| 62 | +# zgen and others |
| 63 | +zgen zdharma-continuum/zsh-diff-so-fancy |
58 | 64 | ```
|
59 | 65 |
|
60 |
| -#### `hg` configuration |
| 66 | +## `hg` configuration |
61 | 67 |
|
62 | 68 | You can configure `hg diff` output to use `diff-so-fancy` by adding this alias
|
63 | 69 | to your `hgrc` file:
|
64 | 70 |
|
65 |
| -``` |
| 71 | +```ini |
66 | 72 | [alias]
|
67 |
| -diff = !HGPLAIN=1 $HG diff --pager=on --config pager.pager=diff-so-fancy $@ |
| 73 | + diff = !HGPLAIN=1 $HG diff --pager=on --config pager.pager=diff-so-fancy $@ |
68 | 74 | ```
|
0 commit comments