Git add recursively for specific extension only

find . -name ‘*.java’ -print0 | xargs -0 git add

You may also like...