{"id":1985,"date":"2012-07-03T01:03:55","date_gmt":"2012-07-03T00:03:55","guid":{"rendered":"http:\/\/t-machine.org\/?p=1985"},"modified":"2013-08-13T20:26:01","modified_gmt":"2013-08-13T19:26:01","slug":"unity-git-source-control-a-basic-gitignore","status":"publish","type":"post","link":"http:\/\/new.t-machine.org\/index.php\/2012\/07\/03\/unity-git-source-control-a-basic-gitignore\/","title":{"rendered":"Unity: Git source control &#8211; a basic .gitignore"},"content":{"rendered":"<p>The most popular hit for &#8220;unity gitignore&#8221; is a post on the official Unity forums that was written by someone who doesn&#8217;t seem to fully understand how git works. Which was a little disappointing.<\/p>\n<p><span style=\"color: blue\">Before you commit anything to git, you MUST go into Unity&#8217;s menus and enable the &#8220;metadata&#8221; option (in settings, moves around a bit between versions). Without that, Unity&#8217;s internal data-bugs will corrupt your project if you ever merge (happens to us approx 1 time in 3 if we forget at start of project)<\/span><\/p>\n<p>After a bit of trial and error, here&#8217;s a basic .gitignore for Unity that seems to work, and cut down the commit sizes by a factor of 4 immediately:<\/p>\n<p>UPDATE: updated with a tried-and-tested gitignore that covers more things. Do please note the big WARNING though, or you&#8217;ll only have yourself to blame&#8230;<\/p>\n<blockquote><p>\n##################<br \/>\n# Unity ignores:<br \/>\n#<br \/>\n#   !!! WARNING !!!<br \/>\n#<br \/>\n#    &#8230; you MUST convert Unity to using Metafiles *before* you start using this .gitignore file,<br \/>\n#        or you WILL lose data!<br \/>\n#<br \/>\n#####<br \/>\n#<br \/>\n#   !!! WARNING !!!<br \/>\n#<br \/>\n#    &#8230; don&#8217;t forget to [git add &#8220;*&#8221;] (quotes are required!) when adding new files, or git will silently ignore them<br \/>\n#<\/p>\n<p># OS X only (not needed on other platforms)<br \/>\n.DS_Store<br \/>\n*.swp<br \/>\n*.Trashes<\/p>\n<p># All platforms<br \/>\nLibrary<br \/>\nTemp<br \/>\n*.csproj<br \/>\n*.pidb<br \/>\n*.unityproj<br \/>\n*.sln<br \/>\n*.userprefs\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The most popular hit for &#8220;unity gitignore&#8221; is a post on the official Unity forums that was written by someone who doesn&#8217;t seem to fully understand how git works. Which was a little disappointing. Before you commit anything to git, you MUST go into Unity&#8217;s menus and enable the &#8220;metadata&#8221; option (in settings, moves around [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,45],"tags":[],"_links":{"self":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1985"}],"collection":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/comments?post=1985"}],"version-history":[{"count":4,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1985\/revisions"}],"predecessor-version":[{"id":2648,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1985\/revisions\/2648"}],"wp:attachment":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/media?parent=1985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/categories?post=1985"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/tags?post=1985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}