module.exports = function (grunt) {

    'use strict';

    grunt.registerTask('dist', 'dist content helper', function () {
        var done = this.async();
        var target = this.args[0];
        var Git = require('simple-git');
        var files = 'dist/*';

        switch (target) {
            case "purge":
                new Git()
                    .rm(files, function (err) {
                        if (err && !/did not match/.test(err)) {
                            done(false);
                        }
                    })
                    .commit('Remove existing built content', files, function (err) {
                        if (err) {
                            grunt.log.warn(err);
                        }

                        done(!err);
                    });
                break;

            case "persist":
                new Git()
                    .add(files)
                    .commit('Adding built content', files, function (err) {
                        if (err) {
                            grunt.log.warn(err);
                        }

                        done(!err);
                    });
                break;

            default:
                grunt.fail.fatal("Unknown target: " + this.name + ":" + target);
        }
    });

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        git: {
            options: {
                message: "Build release <%= pkg.version %>"
            },
            commit: {
                files: [
                    { src: [ 'src/web/release/*.js' ] }
                ]
            }
        },

        release: {
            options: {
                file: 'package.json',
                tagName: '<%= version %>', //default: '<%= version %>'
                commitMessage: 'Release <%= version %>', //default: 'release <%= version %>'
                tagMessage: 'Tag version <%= version %>' //default: 'Version <%= version %>'
            }
        },

        less: {
            development: {
                options: {
                    paths: ['src/web/css', 'src/web/img']
                },
                files: {
                    'dist/<%= pkg.version %>/css/style.css': 'src/web/css/style.less'
                }
            },
            production: {

            }
        },

        copy: {
            main: {
                files: [
                    {
                        expand: true,
                        cwd: 'src/web/',
                        src: ['img/**', 'js/**', '*'],
                        dest: 'dist/<%= pkg.version %>/'
                    }
                ]
            }
        },

        clean: ['dist']
    });

    grunt.loadNpmTasks('grunt-contrib-less');

    grunt.loadNpmTasks('grunt-release-steps');

    grunt.loadNpmTasks('grunt-git');

    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.loadNpmTasks('grunt-contrib-clean');

    grunt.registerTask('install', ['clean', 'copy', 'less']);

    // removes any existing dist already added to git
    grunt.registerTask('clear', ['dist:purge', 'clean']);

    // bumps up the version builds the distribution content and commits it
    grunt.registerTask('create', ['release:bump:add:commit', 'install', 'dist:persist']);

    // tags the project on the new version and pushes everything to remote
    grunt.registerTask('deploy', ['clear', 'create', 'release:push:tag:pushTags:minor']);

};

@@ -316,32 +316,42 @@
 %0A               
+ var git =
  new Git()%0A     
@@ -425,16 +425,16 @@
 if (
+!
 err 
-&& !
+%7C%7C 
 /did
@@ -490,20 +490,75 @@
     
-done(false);
+git.commit('Remove existing built content', files, function (err) %7B
 %0A   
@@ -574,34 +574,32 @@
             
-%7D%0A
         
             
@@ -586,30 +586,26 @@
         
-            %7D)
+if (err) %7B
 %0A       
@@ -621,72 +621,44 @@
     
-.commit('Remove existing built content', files, function 
+                grunt.log.warn
 (err)
- %7B
+;
 %0A   
@@ -674,34 +674,33 @@
             
-if (err) %7B
+        %7D
 %0A           
@@ -712,39 +712,34 @@
             
-grunt.log.warn(
+    done(!
 err);%0A      
@@ -760,46 +760,149 @@
     
+   
-%7D%0A%0A                        done(!err);
+ %7D);%0A                        %7D%0A                        else %7B%0A                            grunt.fail.fatal(err);%0A                        %7D
 %0A   

Allow for no dist content being present when clearing