8

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?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Anthony Naddeo
  • 2,497
  • 25
  • 28
  • Does this answer your question? [Is there any way to make \`git add --patch\` respond to a single \`y\` or \`n\` keystroke?](https://stackoverflow.com/questions/32546358/is-there-any-way-to-make-git-add-patch-respond-to-a-single-y-or-n-keystr) – Mateen Ulhaq Jun 10 '21 at 23:39

1 Answers1

11

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

git config --global interactive.singlekey true
mipadi
  • 398,885
  • 90
  • 523
  • 479