top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Git uses less by default if there is no explicit pager specification

+1 vote

After using "git diff", I believe that Git ( uses "less" by default if there is no explicit pager specification (via $PAGER or Git's core.pager).

1) Am I correct?
2) I dislike defaulting to using a pager (partly because I dislike "less" in particular).
3) In any case, using a pager by default doesn't seem to be documented, either on the main "git" manual page or in "git-config".

posted Aug 16, 2013 by Sheetal Chauhan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

1) Am I correct?


2) a) I dislike defaulting to using a pager

I think you're a part of a minority in this case -- when you work with Git in a shell, having to append " | mypetpager" onto the end of each Git command producing a lengthy output quickly becomes tedious up to a point of creating specific aliases etc. And Git's awareness of the interactivity of the user's terminal does not ends here: if it detects the prospective output would fit into a single screenful, it does not pipe it through less, so when Git is used *interactively,* it's behaviour is just natural -- you have paging exactly when you would need it.

2) b) (partly because I dislike "less" in particular).

I'm not sure what's wrong with less, really: it supports searching in both directions, has control over line wrapping, supports ANSI color codes and even a mode analogous to tail -f -- the latter feature is not applicable here but I'm trying to show that this tool is of general use to a typical command-line-savvy power user.

Also I think less is considered no less standard than cat on a typical contemporary Unix-like system so lots of power users just have finger memory for it, like they do for their text editor of choice.

In either case, alternatives exist (I'm able to recall most off the top of my mind).

answer Aug 16, 2013 by Majula Joshi
+1 vote

It is not clear to me from the above what will improve your situation, but if you are asking how to turn off git's default paging, then setting

 core.pager = cat

will achieve that.

You can easily test that, for example:

git -c core.pager=cat log
answer Aug 17, 2013 by Naveena Garg
Similar Questions
0 votes

I have my global git config pager set to 'cat', but when I do a "git help ", it still uses a pager. This is especially irksome in emacs shell buffers, where I am most of the time. I know I can do a M-x man -> git-, but wondered if this was a bug or user error. ("git --no-pager help " does the same.)

% git --no-pager help log
WARNING: terminal is not fully functional
(press RETURN)
+1 vote

I was wondering if there are any install flags for git to be installed silently and to be able to pre-choose the install options to make it completely silent? Using the standard /S flag for the .exe just seems to launch it as normal.

+1 vote

I use a git server which requires authentication over https. Git seems determined to always try an unauthenticated request first, slowing down operations by a couple seconds.

Is there a way to configure git to default to authenticated requests?

+1 vote

I have added some changes on commit message in prepare-commit-msg file and then I exec this command

git config --global commit.template .git/hooks/prepare-commit-msg  

After that when I do git commit I receive something like this

40 lines of my changes and then  

# Please enter the commit message for your changes. Lines starting # with # will be ignored, 
  and an empty message aborts the commit. # Explicit paths specified without -i nor -o; 
  assuming --only paths... # On branch master # Changes to be committed: # # modified: test #  

Question is there any chance to show this default message on the top? Or better permanently remove this message?

+3 votes

When we clone a remote GIT repository, all folders/files will be cloned. This will consume lot of disk space in our local machine.
Is there a way to clone only few folders & exclude others?

This is possible in clearcase snapshot view by changing load rules.