Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] How do I setup Git for an UE4 project?


My question is simple: how can I setup my git repository for an UE4 project? Or, in other words, which files/folders can I safely include in the gitignore file? Are there some tips to make this works flawless? :)

Thank you in advance!

Product Version: Not Selected
more ▼

asked Mar 23 '14 at 11:45 PM in Everything Else

avatar image

428 7 9 14

avatar image Bob_Gneu Mar 24 '14 at 05:04 PM

Whoever downvoted this questions should provide some justification in the comments to help the community understand what questions are good and what are bad. I believe the current position is that there are no bad questions.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Dec 17 '15 at 07:15 PM by Ben Halliday for the following reason:

The question is answered, right answer was accepted

2 answers: sort voted first

As a general rule, you should check in all files that are required to make a successful build of your project and cannot be generated from other files. If you or someone else clones your project, they must have everything that is needed for the project - not more not less. Files that are not needed for your project or that can be automatically generated from other files in your project should not be included, because that would be a waste of disk space and just cause conflicts when someone downloads your latest version into their local workspace. The only exception may be documentation, readme files and sample code that may help someone with your project.

Here is a typical folder structure for a code-based project. The files and folders in bold should be included, the rest can (and should) be safely ignored:

  • Binaries*

  • Build - any custom build scripts or other build related dependencies you may have

  • Config - the default configuration files for your packaged project

  • Content - maps, content files and assets**

  • DerivedDataCache - temporary data files generated when you run the game

  • Intermediate - temporary files generated when you compile your code

  • Saved - local log & configuration files, screenshots, auto-saves etc. that are generated each time you run the game or Editor

  • Source - the source code of your project

  • If your project uses third-party libraries, i.e. when integrating some software components or hardware devices, you may have DLLs, LIBs or other files in your Binaries directory that must be included if your project depends on them. However, do not include the DLLs and debug files (.pdb) that are generated for the project itself, i.e. MyProject.dll and MyProject.pdb.

**) Make sure you do not discard your raw assets after importing them into the Engine. While they are not strictly required for building the project (the content packages should contain everything needed to run your game), we recommend that you keep them somewhere in version control. If you don't want to keep them in your project's repository (i.e. because you don't want to give them to the public) you should at least maintain some other private repository for yourself so that you do not loose any changes and can always go back to prior versions of textures, static meshes, sounds and so on, if needed.

more ▼

answered Mar 24 '14 at 05:09 PM

avatar image ZachGriffin Apr 04 '14 at 04:06 AM

I've attached my .gitignore file for people to use as they need here. It ignores all the folders as mentioned above. To use it, copy the file into your root repository directory. Open a new command prompt (File->Open Command Prompt) and type "ren gitignore.txt .gitignore" without the quotations to rename the file.

gitignore.txt (51 B)
avatar image crush1983 Dec 06 '15 at 04:10 AM

Another option for creating a .gitignore file is to rename it ".gitignore." The final . will be dropped, and it will not have an extension.

avatar image trojanfoe Jan 07 '15 at 01:46 PM

Please note that .vcxproj files are being added into /Intermediate/ProjectFiles and they certainly don't want to be ignored. However, I could not find a way of whitelisting it successfully within .gitignore so the file has to be explicitly added using git add -f ... :@

avatar image enlight_2014 Jan 07 '15 at 02:11 PM

There's no reason to put the .vcxproj files under source control because they are generated from the contents of the Source directory. Any changes to the project files made by the user will be lost anyway the next time the project files are regenerated.

avatar image trojanfoe Jan 07 '15 at 02:21 PM

Yes, you are right. You can just do File > Refresh Visual Studio Project to regenerate the project file. Thanks.

avatar image enlight_2014 Jan 07 '15 at 02:27 PM

On Windows you can simply right-click on the .uproject file and select Generate Visual Studio project files from the context menu. I presume something similar is available on the Mac. You can also regenerate the project files for the currently open project in UnrealEd via File->Refresh Visual Studio Project.

avatar image Robert42 Oct 11 '15 at 11:12 AM

What about the Content of the Build directory? Can I safely ignore it? Or at least the Build/Receipts subdirectory?

I've noticed, that since 4.9 there's no icon anymore created to the Build directory. So can I safely ignore the Build directory since 4.9?

This is my current .gitignore file:

 # UE4 Project directories to ignore

 # Visual Studio solutions

 # Linux Project files

 # Xcode Project files
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can commit any of your non binary files safely. The primary issue you will run into is binary files - such as assets, which is a problem for any binary file in VCS that does not have context for the files. By and large the issue exists for all common VCSs but with distributed ones like Mercurial and Git this is a compounded issue.

You should ignore the files created for MSVS, as they are likely to be created on any contributors machine when they run the batch script to generate them. This includes the sdf, opensdf, suo, DotSettings files.

You should also ignore the Saves directory as it wont be of much use to your buddies.

You will also want to ignore the Intermediate directory, as everything in there is generated or copied.

more ▼

answered Mar 24 '14 at 03:48 PM

avatar image

374 6 11 79

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question