Whenever I execute the git log
command, it cannot be terminated. If I do Ctrl + C, it exits the paging environment, but if I start to type anything, it starts the git log
command again.
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 the configuration system, 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.