You don't say which version of Netbeans you're using but if it's a recent one you can try to use the "Local History" feature.
That functionality has moved a bit in recent versions but if it's available there should be a History option using Right-Click on the file in the Projects browser. Or also, from the menu Team > Local History.
Right-click again on the proper version in history should show an option to revert to that version.