git add --patch是我的Git工作流程中不可或缺的一部分.唯一令我恼火的是经常不得不在每次y或之后按Enter键n.有没有办法让Git只用一个y或一个n按键接受一个问题的答案?
Ry-*_*Ry- 20
那将是Git配置选项interactive.singleKey.
interactive.singleKey
在交互式命令中,允许用户使用单个键提供单字母输入(即,无需按Enter键).目前,这是由使用
--patch的模式git-add(1),git-checkout(1),git-commit(1),git-reset(1),和git-stash(1).请注意
,如果便携式击键输入不可用,则会自动忽略此设置; 需要Perl模块Term::ReadKey.
也就是说,在您的.gitconfig或等效文件中,添加:
[interactive]
singleKey = true
Run Code Online (Sandbox Code Playgroud)
或运行git config [--global] interactive.singleKey yes,如果你喜欢yes优于true比编辑器和命令更好.