2

I have this in my .gitconfig:

[pager] show = diff-highlight diff = diff-highlight 

When I do git diff, thendiff-highlight is used for color highlighting.

How can I specify on the command line a different highlighter? I want to use diffr, without changing the default in .gitconfig.

I tried git difftool --tool=diffr but this does nit work, and it seems this is different from what I want.

1 Answer 1

3

Set environment variable PAGER or GIT_PAGER for the command:

GIT_PAGER=diffr git diff 

Or set the config value at the command line once:

git -c pager.diff=diffr diff 

Upd. The following command creates an alias:

git config --global alias.diffr '!GIT_PAGER=diffr git diff' 

The alias can be used with parameters:

git diffr HEAD~ 
Sign up to request clarification or add additional context in comments.

2 Comments

thank you. Can I use the environment variable GIT_PAGER inside an alias? For instance, I would like to create an alias git diffr, that would do what GIT_PAGER=diffr git diff does
@400theCat See the update about an alias.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.