0

When I use 'git log', and then type 'q', I still see the logs on my screen as like it was printed to the screen.

I want to do it like in vim, when I open a file in vim and then close it I don't see file content, I see only the vim command. How to let git log not showing the log after exiting? (like in less command)

1 Answer 1

0

Use less utility, it would look like:

$ git log | less 
Sign up to request clarification or add additional context in comments.

7 Comments

@AtheelMassalha to make it permanent you can use shell alias alias git-log-no-rubbish='git log | less', and put it into ~/.bashrc file
@AtheelMassalha it's only alias to 'git log | less'. Check this : linuxize.com/post/how-to-create-bash-aliases . After that you can type in shell git-log-no-rubbish and it will do the same as git log | less
nice, now I see it works I will mark this as correct answer but I bielve there is a way to get the same with "git log" and not with another aliased name thanks for the help!
More likely, you just need to do PAGER=less. What is happening is that git-log is piping its output through PAGER and you are just explicitly overriding that behavior by piping explicitly to less. Also note that all of these will fail (ie, work properly) if you have included X in LESS.
You need export PAGER=less (also, check that GIT_PAGER is empty). If you also have export LESS=X, then less will run as if -X was passed on the command line, giving you the behavior you are trying to avoid.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.