Our team commits to a big git repository.
Recently we've decided to export one of subdirectories (named framework) to a separate repo and remove all branches that contain commits only to that subdirectory.
How can I list such branches?
I've modified this advice to get:
for branch in `git for-each-ref --format="%(refname)" refs/remotes/origin `; do
git ls-tree -r --name-only $branch | grep -q "framework/" && echo $branch
done
However this command returns branches with commits to other subdirectories too.
I've tried expanding this snippet:
for branch in `git for-each-ref --format="%(refname)" refs/remotes/origin `; do
if git ls-tree -r --name-only $branch | grep -q "framework/" ; then
if ! git ls-tree -r --name-only $branch | grep -vq "framework/" ; then
echo $branch
fi
fi
done
However, this command prints nothing.