Tom Hale Tom Hale - 2 months ago 12
Git Question

How do I use a pager for long git add --patch hunks?

When I interactively add

diff
hunks with
git add --patch
, I sometimes get hunks which are longer than the screen.

This is strange to me as I have already set:

[core]
pager = less -FRX --tabs=4

[pager]
# Bypass pager: git --no-pager ...
diff = diff-highlight | less -FRX --tabs=4


What do I need to do to get add to use
pager
?

Answer

Add to your gitconfig:

[pager]                                                                                                                                                                                        
  add = less -FRX --tabs=4

or:

[core]
  pager = less -FRX --tabs=4

[pager]
  # " = true" means use pager defined in [core]
  add      = true
  diff     = true
  difftool = true
  log      = true
  show     = true
Comments