Reputation: 21
I want to be able to launch git diff with two different pagers on demand.
The only way I know is updating the git config and launching the command (or updating the GIT_PAGER variable).
Example of .gitconfig:
core.pager = cat
[Alias]
def-pager = config core.pager cat
diff1 = !git config core.pager less && git diff && git def-pager
That would let me launch git diff as default with cat pager and on demand launch git diff1 and use less pager.
My question is: Is there any other way to do this without changing git config everytime?
Something like:
git --pager=cat diff
git --pager=less diff
Upvotes: 1
Views: 263
Reputation: 21
I found a way
.gitconfig:
core.pager = cat
[pager]
diff1 = less
[alias]
diff1 = diff
This way you link the pager to the same alias.
By launching git diff you would use cat as pager and by launching git diff1 you would use less as pager.
Upvotes: 1