About a month ago I asked a question of how do you source control your Unity projects.
I really appreciate the feedback and I want to share what I ended up doing. Based on these comments I went with working with GitHub Desktop. I've already used this for other projects so I had it all configured already.
I'm going to walk through how to setup the repository and migrate the project from an existing folder to your new source controlled folder.
Setting up a Local Repository
We begin by making a new repository. We do this by clicking File -> New repository.
When New repository is clicked you will be met with a prompt to enter some information about the repository.
For sake of conciseness, we are only going to worry about the Name, Local path and the field I never paid much attention to before Git ignore. This allows the creation of a default .gitignore that will exclude specific files from the check in process. There are a ton of different options to pick from, between, Godot, Unreal and Unity!
First, I will set my Name to CannonToss since that is the project, I am looking to keep under source control.
Second, I want to locate my Local path files to be under my folder of D:\GIT\CannonToss.
Now to choose my Git ignore. I will choose Unity because that is the project I am working with.
Once finished click Create repository and you will have a local repository ready to be published to the server.
Publishing a Repository
Once your local repository is setup we need to publish it to the server.
To do this you will notice there is a button labeled Publish repository. Once you push the button you will get a new prompt. In this prompt it will carry over your Name and Description from the setup.
You can choose to make your repository private by checking Keep this code private. This will only give you or the Organization you associate the repository with to have access to the code.
If you are member of a group that created an Organization in GitHub you can choose to place the repository under that entity so everyone that has access to that Organization has access to the code.
Once this is all setup click Publish repository. Once published you can now go to your GitHub click on your project in the navigation and see the results.
Moving Unity Project to GitHub
Because I am doing this after I started my project, I will need to move these files from a different folder into my Local Path. To do this I locate my existing project folder. For me it's located under D:\Unity\CannonToss.
Then copy all the files and folder and then paste it directly into the new folder where placed your Local path. As a reminder I placed it at D:\GIT\CannonToss.
Once completed the folders will look near identical with the exception of a couple files, primarily, the .gitignore.
Once added go back to your GitHub Desktop app and you will see a list of changes.
Once you know your files have been added add a comment to the summary. Since it's our first check in we can call it Initial Checkin. Once it's been added click Commit to master at the bottom of the list. This will stage the changes to be pushed to the server.
After that you will notice the button at the top that used to say Fetch origin now says Push origin.
Once you push that button and the upload process completes you can now see your changes in GitHub.
Thanks for reading about what I learned and hope you learned something yourself!
What are those other fields?
I skipped a few fields and want to touch on them for those interested.
- Description - This field is a brief summary of your project to serve as an introduction to your project, or reminder for yourself why you made it.
- Initialize this repository with a README - This file can be used to further describe your project. It might contain how to start up/install the project, any dependencies that might not be obvious, or who to contact to start contributing the project among other things.
- License - This lets others know if your open for copying, if you need to be attributed if someone references/uses your work or any other kind. To learn more about licenses check out https://choosealicense.com created by GitHub.
Discussion
So unity doesn't have direct github integration like visual studio? I'm a little disappointed :(
They used to which is why I was partly thrown through a loop. I'm glad I was able to pointed in the right direction to this others solution. π