Checks that we are on a correct git branch before proceeding.
npm install grunt-checkbranch --save-devAnd in your Gruntfile:
grunt.loadNpmTasks('grunt-checkbranch');Include the task as one of your multitasks, optionally passing the desired branch (default: master) after a colon, e.g.:
grunt.registerTask("deploy", ["test", "checkbranch:develop", "copy"]Pass a "negated" branch where further tasks are not allowed by prepending an exclamation mark:
grunt.registerTask("deploy", ["test", "checkbranch:!master", "copy"]To skip checks:
grunt --no-checkbranchTo force checks (disables skipping), add the third param with true:
grunt.registerTask("deploy", ["test", "checkbranch:develop:true", "copy"]