addGitIgnore method

void addGitIgnore(
  1. String fileToIgnore
)

Implementation

void addGitIgnore(String fileToIgnore) {
  if (!exists(pathToGitIgnore)) {
    touch(pathToGitIgnore, create: true);
  }

  /// check that we don't already ignore it.
  if (!read(pathToGitIgnore).toList().contains(fileToIgnore)) {
    pathToGitIgnore.append(fileToIgnore);

    add(pathToGitIgnore);
    commit('ignored $fileToIgnore');
  }
}