Versioning

Hi Rick, Hi Ben.

I was wondering, once we create a Unity/VS project, a whole bunch of files are automatically created/generated.
As far as Git is concerned, would you recommend to track just some of those files (plus those we create) or everything?
As of now, I versioned the Assets directory, the project’s solution file (.sln). I haven’t versioned the Assembly-CSharp.csproj file.
Are there any other file I should version?
For example, if I want to give you access to the repo, what would be the minimum list of files you need to use it?

Thanks for your great work with your courses!

Kind regards,

Ghislain

Hi Ghislain,

If you want an answer from the instructors your best bet is to post your question under the Q&A on Udemy against the specific lecture. One of the students instructors will then try to resolve your query and escalate to the instructors where necessary.

With regards to your question, you are talking about a .gitignore file here, as you have mentioned, both Visual Studio and Unity create a bit more than you really need to commit, here’s an example of a .gitignore file which reduces the amount of content that is committed;

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*

# Visual Studio 2015 cache directory
/.vs/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb

# Unity3D generated meta files
*.pidb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

You can of course add to this as needed. You will often find that applications which offer a .gitignore template from a drop down will have an option for Unity, but this will not include entries for also ignoring Visual Studio, so probably best you customise as needed over time.

Here’s a Google search listing to get you started with some other examples too :slight_smile:

Hi Rob,

Thanks for the suggestion of where to post.
To be fair, a member’s answer (as yours) is as good!
I don’t mind if the files are ignored or not, but I guess that answers still, as if they will be ignored… I don’t need to stage them… QED.

Thanks a lot!

You are, obviously, more than welcome to post on the forums, just be aware that the responses you get will be from peers rather than instructors at least for the most part. They do drop in on occasions, but on each visit there would be so many posts that trying to keep on with them all would be impossible. The Q&A provides a mechanism where, as a student, you can be assured of a response.

Regarding the ignoring, it would be better to ignore them, you’ll find that Unity creates a copy of the project and pops it into the /library/ directory, so your working directory size can get fairly large - if you commit it all to source control, whoever else grabs a copy has to get far more than they need. And yes, the .gitignore file is acted upon when the repository is opened, so these files wouldn’t be listed under a non-staged view for example, so thus, less to stage, less to commit.

One of my own experiences with a team of developers who didn’t set their .gitignore files correctly created a scenario where there were different user preferences being committed by different team members. This made for a fairly miserable time, as little things like the number of spaces for tabbing and line ending encoding etc was being constantly changed, which impacted upon the next developers environment… Not fun… many arguments… :slight_smile:

Privacy & Terms