How do I navigate in the results of Diff

Git

Git Problem Overview


When I do a Git diff, it shows the code with the diff and it looks great. But how do I go to the next page or the next document.

Git Solutions


Solution 1 - Git

Next line             : return
Next page             : space bar
Previous page         : w
Quit viewing the diff : q
Help                  : h

Solution 2 - Git

Hit ? and it should show you the command shortcuts for doing page up/page down etc.

By default git looks at the $GIT_PAGER, then $PAGER environment variable to determine the program to be used for showing you the output of diff, log, show etc.

On new (linux) systems the default $PAGER used (even when it is not set) is less (it used to be the less capable more).

In both less and more the ? key gives you a command shortcut list.

Solution 3 - Git

For scrolling downwards Use j or ↓ to move down one line at a time d to move by half the page screen f to move by a whole page screen

For scrolling upwards use k or ↑ to move up one line at a time u to move by half the page screen b to move by a whole page screen

press q to quit out of the log It will returns to the regular command prompt

Solution 4 - Git

Also, consider installing gitx (Mac) or gitg (Ubuntu) for wonderful (and easy) gui options :)

Solution 5 - Git

I'm running what I think is a stock git install on Windows, msysgit 1.8.3, and for me git diff runs something that claims to be less, version 444. Instead of '?' for help, it wants 'h'. Seems that '?' is the start of some kind of regular expression search.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBarkaView Question on Stackoverflow
Solution 1 - GitwadesworldView Answer on Stackoverflow
Solution 2 - GitholygeekView Answer on Stackoverflow
Solution 3 - GitHarsh ShahView Answer on Stackoverflow
Solution 4 - GitMichael DurrantView Answer on Stackoverflow
Solution 5 - GitSpike0xffView Answer on Stackoverflow