You should find NetBeans creates its own .gitignore file, which ensures the files you don't want in your repo will get ignored by git automatically without you having to manage it through watching what you add and commit. You can pretty much then commit the entire project folder and let git do its thing.
On my projects, those are set to
Depending on your NetBeans version and various settings, this may be slightly different, for example it could be a .gitignore in the project folder that reads
These settings ensure the private section of the nbproject folder (which contains Netbeans-specific project files that should not be shared between machines), the build folder (where java classes compiled from your source are stored), and the dist folder (where the final compiled distributable files of your project end up) are kept out of source control (which only needs the source files necessary to recompile those files)
Don't just commit /src/ unless you really don't mind that you'll not be keeping your NetBeans project files in git. You may also find out you're missing other things such as a resources folder or any other options you've added if you do this, so I recommend committing the entire project folder - NetBeans is designed to deal with what does and doesn't go into git if you do this.