0

Let's say I have 100 commits in my workspace (commit1 - oldest, commit100 - newest). If I do git log --oneline then it shows like this. It keep printing until the oldest and stop.

==============================================
commit10
commit9
commit8
commit7
commit6
commit5
commit4
commit3
commit2
commit1
>>my_branch>main>
===============================================

How can I change this show from the newest like this?

==============================================
commit100
commit99
commit98
commit97
commit96
commit95
commit94
commit93
commit92
commit91
...

===============================================
khelwood
  • 55,782
  • 14
  • 81
  • 108
  • 2
    It sounds like you just want to set GIT_PAGER. You're just seeing the newer commits scroll of the top of the screen. Try `GIT_PAGER=less git log --oneline` – William Pursell May 03 '23 at 19:06
  • @WilliamPursell Yes, this is what I want. Thanks. But how I make this behavior by default without typing GIT_PAGER every time? – user10747383 May 03 '23 at 20:05
  • Your normal shell environment should have PAGER set, which `git` will use when `GIT_PAGER` is not set. You probably just want to add `export PAGER=less` or similar to your shell startup files. – William Pursell May 03 '23 at 21:10
  • `git config --global core.pager less` See [`git help config`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corepager). – phd May 03 '23 at 22:15
  • @phd That totally fixed my issue. Thank you so much folks!! – user10747383 May 03 '23 at 23:37
  • One more question, actually I had used "core.pager cat" to print out git log on console as is, not in edit mode. If I just do "git log" then it goes into the edit mode and printed, so if I want to copy the commit info from inside of edit mode and exit to use it. But it seems I can't use both "cat" and "less" for core.pager, after I do "less", "cat" doesn't work any more. So, can I do "git log --oneline", can I make the commits list print from the latest, not in edit more? – user10747383 May 03 '23 at 23:47
  • @MarcinKłopotek No, it isn't, it shows commit1 commit2 commit3 .... – user10747383 May 04 '23 at 19:03

0 Answers0