Search code examples
reactjsgitdiffgit-diff

Only diff single type of change from a node app?


I have a view in a node React app that I want to either highlight added OR removed lines, but not both at the same time.

Is there an npm module to diff for ONLY added lines OR removed lines.

Something like the git --diff-filter=[ACDM] flag

Select only files that are

* A Added
* C Copied
* D Deleted
* M Modified
* [omitted]

Solution

  • The git-diff package allows you to pass in an options-object.

    You can pass in the --diff-filter=[ACDM] flag that you want via this object.