I'm using GitHub for Windows which generates a nice gitignore ignoring most extraneous files like log files or files specific to VS that don't need to be shared.
From what I can gather from this page in the Unreal docs, you can probably ignore these directories:
DerivedDataCache
Intermediate
Saved
I'm not going to ignore Binaries, if only because I'm working with a level designer who doesn't have VS and so will need the DLL files I build (I assume, I could be wrong).
Again keep in mind I'm using Git for Windows that generates gitignore for you when you create a project, and it's pretty big. I'm pretty much only committing the following (where "ReallyCoolGame" is the name of your project):
.gitattributes
.gitignore
Binaries
Config
Content
Source
ReallyCoolGame.sln
ReallyCoolGame.uproject
I've only just committed this myself, and I've yet to test it with my level designer, so caveat emptor.
Also, I'm referring to a project created using the first-person C++ template, which gets saved to: E:\Documents\Unreal Projects\ReallyCoolGame
(My Documents == E:\Documents
on my machine) and not within the Unreal Engine source directory structure.
Edit: I also don't want to include all the default content, so I'm going to have a subdirectory within Content just for the game assets themselves with the same name as the project, and ignore all other subdirectories of Content. So the lines at the top of my .gitignore now look like:
DerivedDataCache
Intermediate
Saved
Content/*
!Content/ReallyCoolGame
And the level designer will put all of our assets in Content/ReallyCoolGame
instead.
UPDATE:
The Intermediate directory actually contains Visual Studio's project files, which are needed to build the project. If the Intermediate directory is ignored, you won't be able to build the project because the Visual Studio solution won't find it. But there are two easy workarounds for this.
1) Just don't ignore the Intermediate directory. Of course in that case Visual Studio will still find all project files it needs and be able to build the project.
2) This one is even better, especially for version control: Open your project in Unreal Engine 4 editor and go to "File > Refresh Visual Studio Project". This will generate an all new solution file for you, which means you won't even need to commit it and can add the *.sln in the project folder to the .gitignore file.
Also *.suo and *.sdf files can be ignored in general, since Visual Studio just generates new ones when you open your solution.