git - 沉默 git rebase --interactive 的“如何进行”消息
问题描述
我编写了一个脚本来自动git rebase --interactive
编辑指定的提交,使用GIT_SEQUENCE_EDITOR=sed ...s/pick/edit/...
如何防止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
钩子的任何错误,所以 2>/dev/null
不是一个选项。
从git config 文档中,我尝试过:
git -c advice.statusHints=false rebase --quiet --interactive --autostash --autosquash "$commit"~
我也试过禁用advice.resolveConflict
and advise.detachedHead
。
下似乎没有任何有用的选项
rebase.*
。
解决方案
git-rebase--preserve-merges.sh
(调用warn ()
)和都sequencer.c
没有提供任何选项来阻止显示该警告。
您可以git-rebase--preserve-merges.sh
在本地进行修改,但这不会是可移植的(git rebase
而且无论如何都会用 C 重写,从 Git 2.19 开始)
或者,您可以提交带有新设置的补丁程序,以使该警告静音。
或者,正如kostix在评论中建议的那样,您需要处理命令的输出以过滤掉您不需要的内容:
你最好的选择可能是通过你的钩子脚本完全匹配它并消灭它。
可能分两步执行此操作:
- 如果匹配则匹配
^Stopped at [[:xdigit:]]+.*$
并删除它;- 如果匹配并删除,则匹配整个以下横幅并删除(如果匹配)。
(虽然 kostix 建议使用比 bash 更高级的语言来做到这一点)
推荐阅读
- load-balancing - AWS-ALB 未将流量转发到 EKS 上新添加的后端 pod
- python - Python 字典访问比列表索引访问更快
- kubernetes - Prometheus 中的 Pod 级别监控,用于部署在不同 kubernetes 集群中的应用程序
- iis - 将映射 url 重写为 Windows Server 2016 上根文件夹 IIS 10 中的地址
- html - 如何在此处放置 if else 语句:
- html - 非中断空格,在 Div 页面时中断
- r - R:保存您在会话中输入的所有代码
- python - 寻找在python中按行数分割大型文本文件的有效方法的想法
- sql - 创建触发器以从一列更新到另一数据库列
- file - 是否可以使用针对具有重复内容的多个文件进行优化的压缩器/数据结构?