git diff master --numstat | \
grep test | \
awk -F '\t' '{print $1}' | \
grep . | \
node -e "console.log(require('fs').readFileSync(0).toString().split('\n').reduce((s, n) => s + (parseInt(n, 10) || 0), 0))"
Explanation
# Get the num stat between HEAD and master
git diff master --numstat | \
# Filter only relvent data
grep some-filter | \
# Get first column i.e number of added lines
awk -F '\t' '{print $1}' | \
# Removed empty lines
grep . | \
# Sum each line
node -e "console.log(require('fs').readFileSync(0).toString().split('\n').reduce((s, n) => s + (parseInt(n, 10) || 0), 0))"