How to share the code with my team?
I'm working with a team on a game and was planning on sharing the code to a repository on GitHub. I was wondering if will work for sharing the code with my team? I am also a little confused by the gitignore do i need one? and if so where should i put it? thanks
Answer by GabLeRoux · Sep 28, 2016 at 08:48 PM
You can share your code on github or any repository provider, keep in mind that if you use github, it will be public unless you pay for a private plan. Bitbucket currently has free private repository for less than 5 contributors I think. You can also host your own gitlab
Using git to share code is the right thing to do.
Use the following Unity .gitignore file and place it at the root of your project (where your unity project is) and name it .gitignore
. Then you can do the usual steps to start a repository.
Also note that the .gitignore
will only be effective for untracked files which means that if you've already added files to git before using ignoring files, they will still be tracked. One way to solve this is to delete the files listed by the .gitignore
with git rm
command and commit this.
Answer by ThunderClap220 · Sep 28, 2016 at 09:30 PM
Awesome! Thank you for the info. This is probably a stupid question, but I am new to all of this. Will the dev. team have access to the whole unity project and all the changes? Or will it just be the scripts?
It will have acces to everything, but it isn't really useful. The scripts/prefabs etc can be used, but you have to take a few extra steps in order to share Everything (Don't know it outta my head, sorry)
Yes, everything that you will track with git and commit will be synced on your remote git repository when you push to it. Every file will be used unless you tell git to ignore them or if you just don't add them to git. If for example you use a file in your project that is not in your project folder, then it won't be included so avoid this, but rverything else should be included.
I suggest you follow some tutorials and you should also ask your $$anonymous$$m to follow tutorials.
Github as a cool tutorial: * https://try.github.io/levels/1/challenges/1
At least ask your $$anonymous$$m to complete this.
And here'/ an other interactive one (I haven't tried it, but it looks cool and may go deeper): https://github.com/jlord/git-it-electron
There are a few visual guides yo help you understand what happens when you use git commands: http://learngitbranching.js.org http://www.wei-wang.com/ExplainGitWithD3/
You can also search for tutorials online, there are a lot of them. Concerning using git with unity itself with tips and what to keep and what to discard, there are a few questions and answers here and there. Usually, it's about should I keep meta files (yes), what can I ignore (what's in the gitignore file above), etc.
There is this official guide from unity that shows how to use bitbucket with unity and the ui app sourcetree: https://unity3d.com/fr/learn/tutorials/topics/cloud-build/creating-your-first-source-control-repository
I strongly suggest you learn the commands first before using a ui with git so you know what it's actually doing.
When it comes to larger files, you may want to use git-lfs as explained ine the following q/a: http://stackoverflow.com/questions/18225126/how-to-use-git-for-unity-source-control
I think that's enough to get you started, go create some amazing games now!
Thank you guys! You've helped me a ton. I will pass on this info to my $$anonymous$$m for sure.
Your answer
Follow this Question
Related Questions
How do I implement swipe function to run? 0 Answers
When I download my project from Github, all my assets are 1kb and invisible in scene and game... 0 Answers
need help with simple timing code 1 Answer
I need help tweaking my telepoting code!!! Please Help!!! Description is long but necessary. 0 Answers
A code prob. (java) 0 Answers