git - 沉默 git rebase --interactive 的 "how to proceed"消息

标签 git git-rebase git-config git-interactive-rebase

我已经 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.resolveConflictadvise.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:

  1. match ^Stopped at [[:xdigit:]]+.*$ and remove it if matched;
  2. 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/

相关文章:

git - 重新定位远程功能/错误/主题(私有(private))分支

git reword 没有再次解决 merge 冲突

git - 如何删除 git 用户属性?

git - 我可以用 git 做一个目录列表,显示最新的提交日期吗

linux - git push 在挂载的 davfs 上失败

git - 如何推送到另一个用户下的远程仓库

windows - 为可移植 git 配置移动目录

git - 如何通过 shell 命令行向组授予对 Bitbucket 存储库的写访问权限

git - 从 git 恢复特定的提交

git - Git Server 上的域名更改