Search code examples
githead

To color a limited number of lines in git log --oneline


When I pipe a git command to head to display only a few dozens of commits, the colors are lost:

git log --oneline | head -50

How to keep colors with a limited number of lines?


Solution

  • -(n) Show only the last n commits

    Ref : https://git-scm.com/book/no-nb/v1/Grunnleggende-Git-Viewing-the-Commit-History

    For exemple

    git log -50 --oneline