When using a git command that can has a large amount of output (like git log
, git diff
or git blame
), Git opens the command outpu T in our terminal "pager"; On most modern unix-based systems, the default pager would be ' less '. Learning a few less commands would help us deal with this git command output that opens in the pager. In this lesson, we show some of the very useful of the less commands: (quit), (off), (up q
j
k
), Ctrl f
(Forwar D), Ctrl b
(Backward), ( /{search}
search), and n
/ N
(next/previous search result).
This lesson is covers some of the most critical less commands; There is more commands available. A good chunk of the commands (and "motions") of the Unix pagers is also used by VI (or VIM) and other UNIX programs.
One useful tip when we doing ' git log ' are search term:
git log // show the git logs'/'/ ' seach for bugs in our logs
And also if you want to nav between the search results, you can do:
' N ' 'n'+ N
[Practical Git] Navigate git command pager output with Unix less commands