11

I'm trying to use my computer with keyboard only, without touching the mouse.

In git-gui, how do I move the keyboard focus to the list of changed files, so I can stage them (Ctrl + T) one-by-one? I know I can stage all changed files with Ctrl + I, but it doesn't work for staging newly created files.

Jasper
  • 2,166
  • 4
  • 30
  • 50
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
  • 1
    If you're trying to do it all with the keyboard, why bother with git gui? You could just run `git add .` from the top level of the repo to add all modifications and newly created files. – Cascabel Aug 20 '10 at 21:44
  • 1
    I'm aware of `git add .`. I like using the GUI and I like using it with the keyboard only. – Ram Rachum Aug 21 '10 at 07:56
  • Fair enough. Just a rare preference - my keyboard-only tendencies are exactly why I use CLIs not GUIs. And I have no idea about an answer - I can't even get focus in there by clicking on it, so I doubt there's much hope with the keyboard... – Cascabel Aug 21 '10 at 12:46
  • 2
    Very pertinent question. This bothers me too, always. – lprsd Aug 21 '10 at 14:02
  • I just experienced that if one starts git gui and just used `CTRL+T`, the focus stays at "Unstaged Changes". Manually clicking anywhere else moves the focus away. No way to recover. - I filed an issue for git for windows. Let's see, if an expert of git gui can take over - https://github.com/git-for-windows/git/issues/859 – koppor Aug 20 '16 at 07:13

2 Answers2

2

You can control a few things with the keyboard:

  • using Alt + <1st-character-menu-item> to open a menu, e.g. Alt + C for the Commit menu
  • there are a bunch a shortcuts available like F5 for refresh
  • using Shift + Tab and Ctrl + Tab you jump around the buttons Rescan to Push, New Commit to Amend Last Commit and to the Commit Message box

However I found no way to jump to the [Un]Staged Changes boxes and also to [un]stage hunks or lines.

Jasper
  • 2,166
  • 4
  • 30
  • 50
Paul Pladijs
  • 18,628
  • 5
  • 28
  • 31
1

A patch was made to enable ALT+1 (and numbers up to 4) to focus the widgets of the git-gui interface:

  • ALT+1 focus "Unstaged Changes"
  • ALT+2 focus "Staged Changes"
  • ALT+3 focus the diff view
  • ALT+4 focus the commit message dialog

You can read more about the implementation discussions here

birgersp
  • 3,909
  • 8
  • 39
  • 79