module.exports = class GitStatusUtils

GitStatusUtils

GitStatusUtils Class Methods:

getStatus(dirName='.')

Returns a javascript object of information from calling git status, like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  branch: "master"
  remote: "origin/master"
  commitsAheadBehind: -5
  stagedChanges: [
    "new file: docs/api/index.html"
    "modified: package.json"
    ...
  ]
  unstagedChanges: [{
    "deleted: relative/path/to/file.ext"
    ...
  }]
  untrackedFiles: [
    "path/to/file.txt"
    "another-path/to/file.txt"
    ...
  ]
}

Note that remote and commitsAheadBehind are not always given by git status, for example, files a local branch with no tracking remote