如何为Yeoman项目创建部署git分支?

时间:2015-06-11 01:36:56

标签: git deployment gruntjs yeoman branching-and-merging

我使用Yeoman创建了一个新项目。使用Grunt我创建了dist目录。我的整个项目都在Github上,https://github.com/d3a1i0/mykungfuisstrong.com,我创建了一个prod分支。我的问题是如何让我的prod分支只包含dist的内容而不是dist目录及其内容。这样,当我在master上工作并且我想部署时,我可以将新的更改提交到prod分支。我试图这样做,所以我可以设置grunt-build-control,我可能会在另一个时间有更多的问题。

1 个答案:

答案 0 :(得分:1)

grunt-build-control的文档中,任务的重点是您不必担心它。 任务期望一个完整的分支,编译到一个构建文件夹,并将为您处理其余的:构建,然后将结果提交到本地分支 - 然后推送到正确的repo(如Heroku如果你愿意,可以部署回购。

如果您只想提交分支,并且它被称为prod,那么您的Gruntfile将是:

buildcontrol: {
    options: {
        dir: 'dist',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
    },
    build: {
        options: {
            remote: '../',
            branch: 'prod'
        }
    }
}

然后你会打电话给grunt buildcontrol:build

相关问题