问题描述
我试图脚本rebasing和我的脚本将采取不同的路径取决于如果rebase导致任何冲突。
I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts.
有没有办法确定是否在编写本文时(Git v2.10.0), the git rebase
command offers no --dry-run
option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts.
但是,如果运行 git rebase
并发生冲突,该进程将停止并以非零状态退出。你可以做的是检查rebase操作的退出状态,如果它不为零,运行 git rebase --abort
取消rebase:
However, if you run git rebase
and hit a conflict, the process will stop and exit with a nonzero status. What you could do is check the exit status of the rebase operation, and, if it is nonzero, run git rebase --abort
to cancel the rebase:
git rebase ... || git rebase --abort
这篇关于有没有某种'混帐rebase -dry-run',会提前通知我冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!