Nellington
Nellington

Reputation: 221

How do you scroll up/down using your mouse/keyboard in Git Bash?

I'm running windows 10 and I've just installed Git version 2.29.2.windows.2

I'm trying to learn Git on Udemy and the instructor can clear his screen by typing clear. However, he can also scroll up and down to see the commands he'd previous typed after he's cleared them. I'm unable to do that. I can't scroll with the mouse. Page up/Down don't do anything and nor do the arrow keys. Once I've typed clear, all my previous commands seem to disappear and I can't access them. I've had a look at the Git Bash options and I can't see anything which would fix this. I've also searched this site for answers but the most recent one I could find was from 2016 and is out of date and doesn't work.

Could anyone explain how I can scroll once I've entered clear so that I can see my previous commands? Thanks.

Upvotes: 0

Views: 1561

Answers (1)

lordadmira
lordadmira

Reputation: 1832

It's not normal for the mouse scroll to retrieve history entries. It usually scrolls up the terminal window. Here are a few things to try.

Make sure you're using the Git Bash terminal using Mintty, not the Windows command prompt running bash.

Up-arrow and down-arrow are the same as Ctrl-P and Ctrl-N.

Run stty sane.

Do bind -p |less and look at the entries for next-history and previous-history. They should look like:

"\C-n": next-history
"\eOB": next-history
"\e[B": next-history
"\C-p": previous-history
"\eOA": previous-history
"\e[A": previous-history

Check your ~./inputrc and /etc/inputrc files.

Read the Bash man page sections for READLINE and bind.

Upvotes: 2

Related Questions