I sometimes have long line of code in git repo (e.g. a json config file), and git diff
will generate output like below.
On an EC2 instance, I git diff
doesn't wrap the content to the next line, generating following output (I can use left/right keys to navigate), which I personally prefer.
Does any one know how I can config the git-diff
to change from one behavior to another?
less
as your pager, set the-S
option. (I like to think of S as standing forSideways Scroll
.) The defaults in Git are complex: see stackoverflow.com/a/18781512/1256452. Note that settingS
can interfere a bit withF
: unix.stackexchange.com/q/231427/162084vi
orvim
, then you can get same result of theless
by doinggit diff | vi -
orgit diff | vim -
too.