我已经 written a script使用 GIT_SEQUENCE_EDITOR=sed ...s/pick/edit/...
git rebase --interactive
编辑指定的提交
如何阻止 git rebase --interactive
打印出的“有用”消息:
Stopped at 307c446... Add candy-text
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
此消息被打印到 STDERR,我仍然希望看到 rebase
命令本身和/或任何 {pre,post}-rebase
Hook 的任何错误,所以 2>/dev/null
不是一个选项。
来自git config documentation ,我试过:
git -c advice.statusHints=false rebase --quiet --interactive --autostash --autosquash "$commit"~
我也试过禁用 advice.resolveConflict
和 advise.detachedHead
。
下面好像没有什么有用的选项
rebase.*
.
最佳答案
两者都是git-rebase--preserve-merges.sh
(其中 calls warn ()
)和 sequencer.c
不要提供任何选项来阻止显示该警告。
您可以在本地修改 git-rebase--preserve-merges.sh
,但这将不可移植(加上 git rebase
is being rewritten in C anyway, starting with Git 2.19)
或者你可以 submit a patch使用新设置可以使该警告静音。
或者,作为 kostix建议 in the comments ,您需要处理命令的输出以过滤掉不需要的内容:
your best bet may be to match it exactly by your hook script and wipe out.
Possibly do this in two steps:
- match
^Stopped at [[:xdigit:]]+.*$
and remove it if matched;- if matched and removed, match the whole following banner and remove, if matched.
(尽管 kostix 建议使用比 bash 更高级的语言来做到这一点)
关于git - 沉默 git rebase --interactive 的 "how to proceed"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52324972/