async verifyTargetDir(dir) {
    const isGitRepo = await git(dir).checkIsRepo();

    if (isGitRepo) {
      //Need to figure out root of the repository to properly verify .gitignore
      const root = await git(dir).revparse(['--show-toplevel']);
      const gitInfo = git(root);

      //Skipping verification if workDir inside repo is declared in .gitignore
      const workDir = path.relative(root, dir);
      if (workDir) {
        const checkGitIgnore = await gitInfo.checkIgnore(workDir);
        if (checkGitIgnore.length !== 0) return;
      }

      const gitStatus = await gitInfo.status();
      //New files are not tracked and not visible as modified
      const hasUntrackedUnstagedFiles = gitStatus.not_added.length !== 0;

      const stagedFiles = gitStatus.staged;
      const modifiedFiles = gitStatus.modified;
      const hasModifiedUstagedFiles = (modifiedFiles.filter(e => stagedFiles.indexOf(e) === -1)).length !== 0;

      if (hasModifiedUstagedFiles || hasUntrackedUnstagedFiles) throw new Error(`"${this.targetDir}" is in a git repository with unstaged changes. Please commit your changes before proceeding or add proper directory to .gitignore file. You can also use the --force-write flag to skip this rule (not recommended).`);
    } else {
      const isDirEmpty = (await readDir(dir)).length === 0;

      if (!isDirEmpty) throw new Error(`"${this.targetDir}" is not an empty directory. You might override your work. To skip this rule, please make your code a git repository or use the --force-write flag (not recommended).`);
    }
  }
Check if given directory is a git repo with unstaged changes and is not in .gitignore or is not empty
@private
@param  {String} dir Directory that needs to be tested for a given condition.