git 将不同的分支推送到 Heroku
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25834500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Push different branch to Heroku
提问by tommyd456
Just finised work on my other
branch. Now I need to test that this works on Heroku before I merge with the master
branch.
刚刚在我的other
分支上完成了工作。现在我需要在与master
分支合并之前测试这是否适用于 Heroku 。
Is it possible to push the other
branch to Heroku and it replace the contents of my last push which was from the master
branch?
是否可以将other
分支推送到 Heroku 并替换我上次推送的来自master
分支的内容?
回答by amgaera
Yes, pushing to a branch named differently that your current one is possible using the syntax:
是的,可以使用以下语法推送到与您当前的分支名称不同的分支:
git push heroku other:master
This tells Git to push the contents of your other
branch to the master
branch on the heroku
remote. Keep in mind that you may have to force push if there are commits on heroku/master
that don't appear in your other
branch.
这告诉 Git 将other
分支的内容推送到远程master
分支heroku
。请记住,如果有heroku/master
未出现在您的other
分支中的提交,您可能必须强制推送。
For more information have a look at the documentation of the <refspec>
optionto git push
.
欲了解更多信息,有一个看的的文件<refspec>
选项来git push
。
回答by Ashad Nasim
git push -f heroku otherBranch:master
The -f (force flag) is recommended in order to avoid conflicts with other developers' pushes. Since you are not using Git for your revision control, but as a transport only, using the force flag is a reasonable practice.
建议使用 -f(强制标志)以避免与其他开发人员的推送发生冲突。由于您没有将 Git 用于版本控制,而仅用作传输,因此使用 force 标志是一种合理的做法。
source :- offical docs
来源:-官方文档