hunk.code_window:     "less": "^2.7.2",
       "less-loader": "^4.0.2",
       "loader-utils": "^1.0.2",
       "lodash": "^4.11.1",
       "magic-string": "^0.19.0",
       "minimatch": "^3.0.3",
       "node-modules-path": "^1.0.0",
       "nopt": "^4.0.1",
       "opn": "4.0.2",
  
hunk.labels: keep keep keep keep add keep keep keep keep
hunk.after_edit:     "memory-fs": "^0.4.1",
  
hunk.file_path: package.json
hunk.type: add
file: import {git, silentGit} from './process';
  
  
  export function gitClean() {
    console.log('  Cleaning git...');
    return silentGit('clean', '-df')
      .then(() => silentGit('reset', '--hard'))
      .then(() => {
        // Checkout missing files
        return silentGit('status', '--porcelain')
          .then(({ stdout }) => stdout
            .split(/[\n\r]+/g)
            .filter(line => line.match(/^ D/))
            .map(line => line.replace(/^\s*\S+\s+/, '')))
          .then(files => silentGit('checkout', ...files));
      })
      .then(() => expectGitToBeClean());
  }
  
  export function expectGitToBeClean() {
    return git('status', '--porcelain')
      .then(({ stdout }) => {
        if (stdout != '') {
          throw new Error('Git repo is not clean...');
        }
      });
  }
  
  export function gitCommit(message: string) {
    return git('add', '-A')
      .then(() => git('status', '--porcelain'))
      .then(({ stdout }) => {
        if (stdout != '') {
          return git('commit', '-am', message);
        }
      });
  }
  