Odd result from issuing 'git branch' command in Konsole window

This is really odd but when the current directory is a git repository and I issue the command:

git branch

the result is that a vi editor window opens up with the output from the git command in a vi window. Does anybody have any idea why this happens ? Other git commands return their response as expected as the Konsole output. Does anybody have any idea why this might be happening ? I admit this is totally baffling to me.

Hi
That’s correct, it’s showing the list of branches (git branch --list), AFAIK it expects the name of your branch, then switch to it…

it should be a less output, not vi. The default less needs a q to quit even if the output has only a few lines. I usually set the pager to “less -F -X” which suppresses that obnoxious need to q for output shorter than the terminal


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

just google for git core pager. There are lots of other possibliities for pager

You are correct, it is ‘less’. That is my mistake. Why would the ‘git branch’ command, which just lists the branches of the git repository, be using the ‘less’ command to do so ? Makes no sense to me and needlessly complicates a simple procedure. I do not understand why ‘less’ goes into pager mode when the number of output lines easily fits in the Konsole window.

you need to ask that from the git devs :wink:

But it does make sense for any reasonably sized production repo with short lived feature branches. The list can get quite long quickly. It just does not make sense when the output is only a few lines and upstream should set the default less options accordingly. But since it is easy to change locally, they will probably not bother

I found a post about the settting up of the git pager and was able to turn off its functionality in OpenSUSE. Thanks for your help !