scrolling down git diff from mac terminal

git diff uses the same pager as less Unix command.

  • Use keys d and u to go down / up half pages (forward / backward technically)
  • Jump to last line: G
  • Use h if you want to display the help

Another trick is storing the diff as a patch file like they used to do in the email days! Then you can open up the patch in any program (Sublime has syntax highlight red/green)

Some examples:

git diff master > ~/patch

git show someCommitSHA > ~/patch

git diff master myBranch -- *.js *.css > ~/patch patch of js & css diff from master


git apply ~/patch

Normally you would use the patch by applying the diff, but you can just open the file in any text editor. It’s useful if you don’t want to make a full commit out of your diff, but still want to use it somewhere else or send it to a friend


You can also use git diff master | grep -C 2 someKeyword to show diff +/- 2 lines around some keyword

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)