Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git log/show etc. replaces the terminal screen

Tags:

I recently started to use zsh (oh-my-zsh, without customizations) on iTerm2. But, I'm having a trouble in git log or git show.

Previously, for example, the git log results were just a part of the terminal, just like ls -l result. After quitting git log by pressing q key, the result was remained in the terminal screen. I was able to pick some hash id easily.

However, the current problem is that git log (or git show) results replace the screen. So, after quitting git log, the terminal completely removes all git results and returns to the original screen. This behavior is like vim.

This behavior is the same even with bash or Mac's default terminal app. This is not a problem of --no-pager.

Any helps would be appreciated.

like image 545
Nullptr Avatar asked Nov 08 '15 08:11

Nullptr


People also ask

How do I get out of Terminal after git log?

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.

What is git log used for?

What does git log do? The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA)

Does git log show all branches?

Graph all git branchesDevelopers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.


1 Answers

Can you try with:

git config --global --replace-all core.pager "less -F -X" 

From "How do I prevent git diff from using a pager?":

passing the -F option to less causes it to quit if the content is less than one screen, however after doing so the screen is reset and you end up not seeing the content, the -X option does away with that behaviour.

like image 81
VonC Avatar answered Oct 10 '22 07:10

VonC