gitinteractivegit-add

How can I make git add -p accept keystrokes without waiting for me to press Enter?


git add -p is very convenient for staging changes in an interactive fashion. At each change, it prompts the user to press a key to determine what Git should do with the change in question:

Stage this hunk [y,n,q,a,d,/,K,j,J,g,s,e,?]?

Is there anyway to make git move onto the next hunk without having to hit Enter?


Solution

  • Yes. Set the config option interactive.singlekey to true:

    git config --global interactive.singlekey true
    

    Additionally, make sure, that libterm-readkey-perl is installed.