0

I needed the list of files which are changed in a new from the current local master. Is there any git command to produce the results or any node packages to make the thing simple?

I have tried https://github.com/clakech/committed-git-files which was quite confusing. Can someone suggest me some node packages to do the same?

  • 1
    Possible duplicate of [Get all files that have been modified in git branch](https://stackoverflow.com/questions/10641361/get-all-files-that-have-been-modified-in-git-branch) – Nicholas K Aug 09 '18 at 17:52

2 Answers2

2

git diff --name-only XXXXXX master where XXXXXX is the branch you're comparing against master

Edit: To get a list of changed files in an array in node

const sh = require("run-sh");

sh("git diff --name-only XXXXXX master").then(function(res) {
  const changed = res.stdout.split("\n");
});
WilliamNHarvey
  • 2,335
  • 2
  • 17
  • 26
  • The command seems to work well for my case. It would be great if there is a node package to push out the file names in an array :) – Theenadayalan Aug 09 '18 at 20:09
  • I have this node package: `https://www.npmjs.com/package/run-sh`. You could split the result by newlines if you'd like – WilliamNHarvey Aug 09 '18 at 21:00
1

From your local branch

git diff --name-only master_branch
Nicholas K
  • 15,148
  • 7
  • 31
  • 57