Heroku有一个忽略所有分支的政策,除了“master”。
虽然我确信Heroku的设计者有很好的理由采用这种策略(我猜是为了存储和性能优化),但对我来说,作为一名开发人员,无论我在做什么本地主题分支,我都希望有一种简单的方法将Heroku的master切换到本地主题分支,并执行“git push Heroku -f”来覆盖Heroku上的master。
我从阅读http://progit.org/book/ch9-5.html的“Pushing Refspecs”部分中得到的是
git push -f heroku local-topic-branch:refs/heads/master
What I'd really like is a way to set this up in the configuration file so that "git push heroku" always does the above, replacing local-topic-branch with the name of whatever my current branch happens to be. If anyone knows how to accomplish that, please let me know!
The caveat for this, of course, is that this is only sensible if I am the only one who can push to that Heroku app/repository. A test or QA team might manage such a repository to try out different candidate branches, but they would have to coordinate so that they all agree on what branch they are pushing to it on any given day.
Needless to say, it would also be a very good idea to have a separate remote repository (like GitHub) without this restriction for backing everything up to. I'd call that one "origin" and use "heroku" for Heroku so that "git push" always backs up everything to origin, and "git push heroku" pushes whatever branch I'm currently on to Heroku's master branch, overwriting it if necessary.
Would this work?
[remote "heroku"] url = git@heroku.com:my-app.git push = +refs/heads/*:refs/heads/master
在我开始试验之前,我想听听更有经验的人的意见,尽管我想我可以在Heroku上创建一个虚拟应用程序并进行试验。
至于抓取,我并不关心Heroku存储库是否只写。我仍然有一个单独的存储库,如GitHub,用于备份和克隆我所有的工作。
脚注:这个问题类似于良好的Git部署使用分支策略与Heroku?< / >,但并不完全相同