Is there a way to copy text in git bash (on Windows) using just the keyboard?

Viewed 1468

I want to copy text, either -

  • the output of the previous command, OR
  • any text present in the bash window,

simply by navigating the cursor and selecting the text using only the keyboard. I do not want to use the mouse at all.

  1. Is there any way to do this?
  2. If impossible, is there any way to do this with minimal use of the mouse?

Example use case - copying the name of a branch, or a commit ID (from a previous git log or git branch) and then pasting it in a git command for switching to it.

3 Answers

You can check the shortcut by

with keys: > options > keys > shortcuts

or

with mouse > options > mouse > mouse functions

The solution that worked is for:

  • desktop keyboard: [shift] + [insert] keys to paste

  • laptop keyboard: [shift] + [0] keys to paste

NB: For laptops, the 0 Key at the bottom of the number pad on the upper-right corner of your keyboard will function as an Insert Key when Num Lock is turned off. That is why it is labeled with both 0 and Ins on the key itself.

You can copy but can't paste text or number on Windows.

Just copy with shortcut ctrl + v. After copying, press right mouse click to paste wherever you want.

Paste will reset when press left mouse button.

Related