6

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
  • 54,300
  • 24
  • 162
  • 166
Anthony Naddeo
  • 2,164
  • 21
  • 25
  • 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

9

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

git config --global interactive.singlekey true
mipadi
  • 380,288
  • 84
  • 512
  • 473