Haven't worked with Unreal Engine but when you create new git repository in GitHub it offers creating gitignore preset for many platforms, including UE.
This should take care of most of unneeded folders right away aside from .vs that you add yourself