Unreal Engine git hooks to force recompilation on source's folder diffs

Hello everyone!

My company allowed me to share some bits of code that might be usefull to the Unreal Engine community.

As a prerequisite, you’ll need to have python installed and git as well. Also these hooks are useless on entirely blueprint based projects.

What the hooks exactly do are:

  • After every checkout, intermediate and binary folders will be deleted if there are diff in the Source folder of your unreal project.
  • The same will be done after every pull and merge.

Why ?
This way, you can just automaticly force recompilation when recieving source code modification. Anyone that is not a programmer won’t ever have to touch to the folders and will just have to recompile a clean version of the project if they recieve new c++ script.

You can find the snippets here.

(there’s also some LFS code, you can get rid of it by deleting line 2 and 4 of both the post-merge and post-checkout hooks)

In order for these to work, you need to download the 3 files and just put them inside your .git/hooks folder.

That’s it! Feel free to share!