Search code examples
windowsgitversion-control

Git for windows paging


Whenever I execute git log command it cannot be terminated. If I do Ctrl + C it exits paging environment but if I start to type anything it starts git log command again.


Solution

  • as mentioned already, git log -X will limit your output to the last X commits.

    Git log and other git commands invoke the less command. This is the pager. To get help with the pager, type ? or h when looking at the output. You will now see the help for the less command. Quitting less is easy, just type q.

    If you don't want log to use a pager utility, you can instruct git not to use it with:

    git --no-pager log
    

    or

    git -P log
    

    (BTW --no-pager and -P work with any git command)

    Git log has a lot of options. To get a quick overview of what has happened, I use

    git log --graph --oneline --decorate --all
    

    Decorate can be set to be enabled by default through config so you don't have to issue it.

    If you think that's a lot to write on the command line, you're right! Bash has a quick remedy for that: CTRL-R. Press that and start typing 'graph'. You should get the last time that you typed that long command. This is one reason I don't bother with git aliases; it's easy to search your command history which persists from session to session.

    Further, you can limit the output of git log to a particular author or particular date range, etc.

    Have fun exploring and stick to the command line. It's what git was meant to be used on. You will also be introduced to a lot of excellent bash techniques that will help you a ton as you get going further with git.