git add -A ignore large files

C++
find . -size +1G | cat >> .gitignore
# Remember to run it each time you want to update the gitignore!
Source

Also in C++: