[英]How to run test before merge a pullrequest
我正在使用带有拉取请求工作流程的GIT( https://www.atlassian.com/git/workflows#!pull-request )。
通常所有开发人员在创建拉取请求之前运行所有测试,但我想确保拉取请求不会破坏构建。
如何在合并拉取请求之前运行我的所有测试?
# Create a temporary branch in your local repository.
git checkout -b temp-branch
# Merge the remote branch that contains the pull request.
git pull git://foo.com/repo.git feature-branch
# Run tests.
make test
# Go back to the previous branch.
git checkout -
# Delete the temporary branch.
git branch -D temp-branch
如果测试通过,则将pull请求合并到实际的目标分支中。
另一种方法是使用仅用于测试目的的暂存分支。 一旦测试通过该分支,提交就可以继续进行。 这种方式可能更容易实现自动化。
也许通过运行git merge --no-commit
,然后运行测试,然后git commit
或git reset --hard HEAD
取决于测试的结果?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.