7

In my new computer (Mac), if I do a git diff, it will only show as much diffs as the height of my terminal window. I then have to press enter to "scroll down" to see all the other changes.

In my old computer, when I did a git diff, it outputted the entire git diff at once and I was able to use the scroll button on the mouse to see everything.

How do I change git settings to achieve the second behaviour?

Fuad
  • 1,419
  • 1
  • 16
  • 31
  • 8
    Does this answer your question? [How do I prevent 'git diff' from using a pager?](https://stackoverflow.com/questions/2183900/how-do-i-prevent-git-diff-from-using-a-pager) – GoodDeeds Feb 11 '20 at 19:23
  • The third answer in there answers my question. But the thing is that entire question thread is asking something different. But oh well. – Fuad Feb 11 '20 at 19:27
  • 2
    The reason you are forced to scroll is likely because `less` is being used to show the output. – GoodDeeds Feb 11 '20 at 19:34
  • I don't think these types of questions should be duped, even though the end solution may be the same. The reason being if someone, like me for example, doesn't know about "pages" or "less", they won't be able to search for the solution that you linked to. But they will search using simple terms as in my question title. Part of the SO experience is that the questions need to be findable based on use-case and existing-knowledge of the user. – Fuad Feb 11 '20 at 19:37
  • 1
    Duplicate questions are still searchable, AFAIK, so it will still lead to the answer through the duplicate question. Nevertheless, apologies if I incorrectly flagged your question -- I did not cast any close vote as I do not have that privilege. – GoodDeeds Feb 11 '20 at 19:42
  • BTW, you can use the space bar to scroll down pagewise. Use 'b' to scroll back pagewise. Use '/' to start a search; that is probably much easier than searching through the scrollback buffer of the terminal without digital help ;) – j6t Dec 22 '20 at 07:35

2 Answers2

5
git --no-pager diff branch1 branch2

Disabling the pager removes the need to hold the enter key and shows all results immediately.

Answer is taken from the linked thread, but this question & the comments below it allowed me to find my way to the answer by searching. How do I prevent 'git diff' from using a pager?

Peter Out
  • 148
  • 1
  • 9
0

I am not sure of how to get all the differences to stdout without having to press enter, but this may help you.

git diff --output=<file_name> [--]
cat file_name

The above command will store all the differences in the 'file_name' file and making the terminal show the file can help you see all the differences in one go.