简体   繁体   English

Heroku可以用作版本控制吗?

[英]Can Heroku work as version control?

I am working with this school project (webapp in RoR) in group of 10 and we get into this fight. 我正在与10人一组的这个学校项目(RoR中的webapp)一起工作,我们进入了这场斗争。

One says we should use Heroku as our web host because it does version control with git. 有人说我们应该使用Heroku作为我们的虚拟主机,因为它使用git进行版本控制。 The other says it's cool to use Heroku as web host, but it doesn't not store old code and keep track of changes, so we should set up our own github/assembla-git. 另一个说使用Heroku作为Web主机很酷,但是它不存储旧代码也不跟踪更改,因此我们应该设置自己的github / assembla-git。

Who is right? 谁是对的?

Heroku uses git for deploy. Heroku使用git进行部署。 So you can use it as version control too. 因此,您也可以将其用作版本控制。

But I would not recommend it. 但我不建议这样做。 When you push to heroku it's mean deploy to production. 当您推送到heroku时,意味着部署到生产环境。 But your code can be not ready for it. 但是您的代码可能还没有准备好。 Not tested yet, feature not fully implemented and etc. 尚未测试,功能尚未完全实现,等等。

You can add 2 remote for your repository. 您可以为存储库添加2个远程对象。

git push origin master # github
git push heroku master 

So I would recommend you use heroku as webhost and github as version control 所以我建议您将heroku用作webhost,将github用作版本控制

There is nothing wrong with using Heroku as your main Git repository. 使用Heroku作为主要的Git存储库没有任何问题。 I have dozens of projects that are set up this way. 我有许多以这种方式设置的项目。

Heroku is definitely not going to arbitrarily delete code or commits in your repository. Heroku绝对不会任意删除代码或在存储库中提交。

Of course, anything you push to the master branch will actually be deployed, but you are free to push other branches if you want (Heroku will simply ignore those). 当然,您推送到master分支的任何内容都将实际部署,但是您可以随意推送其他分支(Heroku只会忽略这些分支)。

The advantage of using GitHub in addition to Heroku is that you get a bunch of extra functionality on top of just the bare Git repository, such as a web-based UI and collaboration tools like pull requests, etc. Keep in mind that GitHub for private repositories is a paid service, however. 除了Heroku之外,还使用GitHub的优点是,您可以在裸露的Git存储库之上获得大量额外功能,例如基于Web的UI和协作工具(例如拉取请求等)。请记住,GitHub是私有的存储库是一项付费服务​​。 There are also competitors to GitHub such as Bitbucket which offers private repositories for free for small teams. GitHub也有竞争对手,例如Bitbucket,它为小型团队免费提供私有存储库。

But if you are already familiar with Git and don't feel like you need any extra functionality on top of it, you might as well just go with Heroku. 但是,如果您已经熟悉Git并不想在其之上需要任何其他功能,那么不妨直接使用Heroku。 There's something to be said for simplicity, as well. 为了简单起见,也有话要说。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM