gpt4 book ai didi

git - 有没有办法让 `git add --patch` 响应单个 `y` 或 `n` 击键?

转载 作者:IT王子 更新时间:2023-10-29 00:58:50 25 4
gpt4 key购买 nike

git add --patch 是我的 Git 工作流程不可或缺的一部分。唯一让我恼火的是每次 yn 后都必须不断地按 Enter 键。有什么方法可以让 Git 接受一个问题的答案,只需按一下 yn 键吗?

最佳答案

那将是 Git 配置选项 interactive.singleKey

interactive.singleKey

In interactive commands, allow the user to provide one-letter input with a single key (i.e., without hitting enter). Currently this is used by the --patch mode of git-add(1), git-checkout(1), git-commit(1), git-reset(1), and git-stash(1). Note
that this setting is silently ignored if portable keystroke input is not available; requires the Perl module Term::ReadKey.

也就是说,在您的 .gitconfig 或等效文件中,添加:

[interactive]
singleKey = true

或者运行 git config [--global] interactive.singleKey yes,如果你喜欢 yes 胜过 true 并且命令胜过编辑器.

关于git - 有没有办法让 `git add --patch` 响应单个 `y` 或 `n` 击键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32546358/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com