如何在重新绑定期间运行所有提交的测试 [英] How to run tests for all commits during a rebase
问题描述
我有一个功能分支,有很多提交。
A --- B --- C主人
\
\ -B'- --C'--- D'...--- Z'功能
我正在工作在特性
上,但另一个开发者创建了提交 B
和 C
。现在我想在提交 C
时重定向特性
,但是我和/或automerge在重新绑定期间引入了错误。我的项目有很好的测试覆盖率,我可以使用 ant rebuild test
从控制台运行测试,现在我想让git告诉我哪个提交是第一次提交,测试,以便我可以修复该提交。我该怎么做?
在分支功能
执行:
$ b
git rebase --interactive --execant rebuild testC
这将导致git在提交C时重新开始,重播您的工作,并在每次之后运行测试在重放阶段提交它。
如果测试失败,希望您的ant任务将具有非零的退出代码。在这种情况下,git会在测试失败后立即停止。你立刻有权修改你的提交,以便测试再次开心。修改之后,像往常一样执行 git rebase --continue
,git将继续检查您提交的所有内容。
I have a feature branch with plenty of commits.
A---B---C master
\
\-B'---C'---D'...---Z' feature
I am working on feature
but another developer has created commits B
and C
. Now I want to rebase feature
on commit C
, but I and/or automerge introduced errors during the rebase. My project has very good test coverage and I can run the tests from console using ant rebuild test
, and now I want git to tell me which commit is the first commit that breaks my test so I can fix that commit. How can I do that?
While you are on branch feature
execute:
git rebase --interactive --exec "ant rebuild test" C
This will cause git to start again on commit C, replay your work on top and it will run your tests after each commit it applies during replay phase.
Hopefully your ant task will have a non-zero exit code if your tests fail. In this case git will stop as soon as the tests fail. You are immediately in the right position to amend you commit so that the tests will be happy again. After you have amended just execute git rebase --continue
as usual and git will continue to check all you commits.
这篇关于如何在重新绑定期间运行所有提交的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!