我该如何让git add -p接受按键输入,而不需要等待我按Enter键?

8

git add -p非常便利,可以以交互方式暂存更改。在每个更改时,它提示用户按下一个键以确定Git应该如何处理该更改:

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

有没有办法让git在不需要按下Enter键的情况下进入下一个hunk?

1个回答

12

是的。将配置选项interactive.singlekey设置为true

git config --global interactive.singlekey true

2
这将改变我的生活。 - Anthony Naddeo
1
文档说明(https://git-scm.com/docs/git-config#git-config-interactivesingleKey)还需要安装Perl的Term :: ReadKey。尝试“apt-get install libterm-readkey-perl”。 - mndrix

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接