8

I know how to select text in git bash console (for example: commit hash) use mouse, but how to do it use keyboard.

Philippe
  • 28,207
  • 6
  • 54
  • 78
john
  • 91
  • 1
  • 1
  • 3
  • Possible duplicate of [How can I select text in git bash terminal in Windows 7 without mouse?](https://stackoverflow.com/questions/41319448/how-can-i-select-text-in-git-bash-terminal-in-windows-7-without-mouse) – Vadzim Sep 28 '19 at 19:01

3 Answers3

7

If your "git bash console" runs inside cmd.exe (and in typical git installation in Windows it is), then you can use cmd.exe window context menu for selecting and pasting:

  1. Press alt+space — it will bring window context menu.
  2. Press e, k — it will select Edit -> Mark menu option.
  3. Now you can move your text cursor around cmd.exe window with arrow keys.
  4. Select block of text by holding shift key and selecting block with arrow keys.
  5. Press enter to copy selected block of text.

You can also paste text from clipboard into console using alt+space, e, p shortcut.

Note that keyboard shortcuts depend on Windows user interface language, described above commands are for English interface.

rutsky
  • 3,900
  • 2
  • 31
  • 30
2

Hold Shift Key and first click at starting of your text then click the end of your selection

Jitendra Suthar
  • 2,111
  • 2
  • 16
  • 22
0

With none of the console, even the very good console2, you can't select and copy with the keyboard because the cursor is constrained in the prompt (except entering the menu with alt shortcuts but it's awefull!!)!

With the git bash console that use 'cmd.exe' behind the scene, you should use the the menu to copy/paste.

With console2, that's easier and all text selected is automatically copied and you just have to paste it with ctrl+v.

But if you prefer the powershell console which is quite better than 'cmd.exe', you could install post-it that add a very good git support to your powershell console...

You could also install Win command paste that permit to paste with the shortcut ctrl+v in the 'cmd.exe' console (and others)

Ps and edit: Bash is for Bourne-again shell (not 'bourne another shell like I wrote before...)

Philippe
  • 28,207
  • 6
  • 54
  • 78