Git diff it always outputting into less even if it's small or no output -
when using git bash (git windows) if command (like git diff
) had short output (i'm guessing smaller terminal's height) print output, in babun (cygwin) every git command seems viewed in less if it's 1 line or empty. "every" perhaps bold, git status
doesn't. seems there pre-bundled setting in 1 of these other doesn't have , don't know is.
how can make git behave when there short output doesn't use less , instead outputs it.
edit: in git bash pager git 'less -x4
' (for 4 width tabs), no -f
. also, environment variables less
, pager
, , git_pager
empty. have no idea why git bash behaving this, luckily i've gotten on how make babun (cygwin) start.
hind-sight update: (this wrong, see 2017-01-12 note.) think git windows and/or default terminal doesn't wipe screen when closing less -- saw behavior somewhere else unrelated (closing less , screen not being wiped) think that's happening. why cygwin , mintty terminal wipe , mingw (or msys2? whatever git windows uses) on windows terminal not beyond realm of knowledge.
hind-sight update post googling: turns out above revalation enough info google solution! post now.
2017-01-12: looks wasn't wiping precisely because less
unset. according man git config
...
core.pager [...] when less environment variable unset, git sets frx (if less environment variable set, git not change @ all). if want selectively override git’s default setting less, can set core.pager e.g. less -s. passed shell git, translate final command less=frx less -s. [...]
schwern's answer half correct. asking still correct answer, using incorrect words. wanted wasn't this:
-f or --quit-if-one-screen causes less automatically exit if entire file can dis‐ played on first screen.
that makes nothing appear short output! if core.pager
less -f
, log less 1 screen, see nothing.
what want less -fx
or maybe less -x
.
-x or --no-init disables sending termcap initialization , deinitialization strings terminal. desirable if deinitialization string unnecessary, clear‐ ing screen.
this question on @ superuser led me this.
using -fx
if log less 1 screen outputs (as if cat
).
using -x
still open less
if output less 1 screen leave on terminal if quit, if don't quit right away can use less
normal. once try search though brings "real" less , still not wipe when done, annoying because windows full of ~
's.
summary
- if don't care happens short output, use
less
- if want short output put on screen if
cat
useless -xf
- if want perhaps search short output (even though it's less 1 screen) use
less -x
, have still press q.
Comments
Post a Comment