[git] How to exit git log or git diff

I'm trying to learn Git with the help of Git Immersion.
There's one thing that frustrates me whenever I use git log or git diff:

Git log shows (END) marker

I can't figure out what to do next when I encounter this (END) word.

I can't type any commands, and I end up closing the current Bash window and open another. How do I type in the next command that I want to use?

This question is related to git git-diff git-log

The answer is


Actually, there are three ways to do it, precisely.

Type any of the following 3 commands.

  1. :q
  2. :z or
  3. Ctrl + z

P.S.: Sometimes, for someone, one of these options doesn't seem to work and for others it works.


Add following alias in the .bashrc file

git --no-pager log --oneline -n 10
  • --no-pager will encounter the (END) word
  • -n 10 will show only the last 10 commits
  • --oneline will show the commit message, ignore the author, date information

You can press q to exit.

git hist is using a pager tool so you can scroll up and down the results before returning to the console.


The END comes from the pager used to display the log (your are at that moment still inside it). Type q to exit it.


In this case, as snarly suggested, typing q is the intended way to quit git log (as with most other pagers or applications that use pagers).

However normally, if you just want to abort a command that is currently executing, you can try ctrl+c (doesn't seem to work for git log, however) or ctrl+z (although in bash, ctrl-z will freeze the currently running foreground process, which can then be thawed as a background process with the bg command).


I wanted to give some kudos to the comment that mentioned CTRL + Z as an option. At the end of the day, it's going to depend on what system that you have Git installed on and what program is configured to open text files (e.g. less vs. vim). CTRL + Z works for vim on Windows.

If you're using Git in a Windows environment, there are some quirks. Just helps to know what they are. (i.e. Notepad vs. Nano, etc.).


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to git-diff

How to show uncommitted changes in Git and some Git diffs in detail Git list of staged files Create patch or diff file from git repository and apply it to another different git repository There isn't anything to compare. Nothing to compare, branches are entirely different commit histories git: diff between file in local repo and origin Git diff between current branch and master but not including unmerged master commits How to Diff between local uncommitted changes and origin How to see the changes in a Git commit? How do you take a git diff file, and apply it to a local branch that is a copy of the same repository? git diff file against its last change

Examples related to git-log

How to get commit history for just one branch? How do I see the commit differences between branches in git? Commit history on remote repository How to exit git log or git diff How to search a Git repository by commit message? Get a list of all git commits, including the 'lost' ones How do I run git log to see changes only for a specific branch? How can I view a git log of just one user's commits? Viewing unpushed Git commits How to view file history in Git?