-3

is there a git command that will list only the folders that are different between 2 branches. I have to create a Powershell script to detect what root folders have changed to determine what VSTS Build to run. So I will re-phrase the question:

I need to be able to run a programmatic command like

git diff branchA..branchB | some-parser-that-outputs-a-list-of-root-folders

the result should look like with

.\codebase1
.\codebase3
.\codebase5
Bob Dalgleish
  • 8,167
  • 4
  • 32
  • 42
  • Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself. – Cyrus Dec 02 '18 at 11:47
  • I have rephrased the question as the duplicate doesn't solve the problem i am trying to deal with – Robert Bartley Dec 03 '18 at 10:03

1 Answers1

0

Git doesn't have a pushbutton for this. I don't know powershell, so I'll give a bash answer. To list trees piecemeal (non-recursively), git ls-tree. To pick only folders, from ls-tree output, grep ^04. To diff those, diff them. On Linux it'd be something like

diff -u0 \
        <(git ls-tree branchA | grep ^04) \
        <(git ls-tree branchB | grep ^04)

suitably munged to strip details you don't want, but as I recall Windows has trouble with process substitution so you'll need to run it through temp files unless powershell has a better way.

jthill
  • 55,082
  • 5
  • 77
  • 137