Here is a folder, which contains a lot of .java files.
How can I git commit this folder ?
If I do the following commands
git add foldername
git commit foldername -m "commit operation"
You don't "commit the folder" - you add the folder, as you have done, and then simply commit all changes. The command should be:
git add foldername git commit -m "commit operation"