git-list-updated
Resolve list of updated (and existing) files
By default it checks difference between HEAD
(so current branch) and master
.
Useful when we want to apply certain operations (e.g. lint) only to files that were updated and not whole repostory
Installation
npm install -g git-list-updated
Usage
CLI
git-list-updated [-h | --help] [--base=<base>] [--head=<head>] [<path>]
If <path>
is not provided, check is done in repository at current working directory
Options:
base
(defaults to master
)
Base branch with which we wish to compare
head
(defaults to HEAD
)
Target containing the changes that should be investigated
Programatically
const gitListUpdated = require("git-list-updated");
gitListUpdated(respositoryRoot, {
base: "master",
head: "HEAD"
})
.on("data", filename => {
console.log(`Updated file: ${filename}`);
})
.then(fileNames => {
console.log(`All updated files: ${fileNames}`);
});
Tests
npm test