this is arguably the most important thing you can do for your game when you start a
project that's going to be a little more long-term i highly highly highly recommend that you use some
kind of source control i'm going to show you guys how to set up git for your unity project but this
really just ensures that you can go back to a previous version if you mess something up it's
basically like a major heavy duty undo button and also if somehow your computer dies and you lose
the data and it gets corrupted you have a backup of your project in the cloud so you can retrieve
that back down on any computer if you want to work on it anywhere else or if your computer somehow
dies so highly recommend setting up version control if you're making any kind of long-term
project that's not like a test or a you know just trying stuff out kind of project it really could
save your project and like prevent you from just quitting and giving up so in this video i'm going
to show you how to set up git with unity and uh let's jump into it for all this stuff is going
to be in the description but first we're going to go to get download just type that into google and
then we're going to hit this first go to download and then download the appropriate one for your
operating system and that will download get onto your computer and then we can go on with the next
step go to github.com you have an account with them so you'll need to set up an account i already
have one so i'm not going to show you how to do that but here is your home page and here you can
you know introduce yourself to it's a public page it's almost like a social media profile but it's
really where you put all of your repositories and repositories as you can see over here on the side
of the screen the repositories is basically just all the projects that you have and this is just a
storage container for really any files it doesn't even have to be code necessarily so you could put
you know a bunch of different pictures up here or something the repositories do have a file
size limit sometimes then you have a space limit for how big of a project you can set up how big
your repo can get but you can just use this as a you know backup storage container if you wanted
to but it's mainly used for code and being able to track the version history of code updates and
that kind of stuff and being able to work on a team this makes it super easy for me to make a
change push it up and then an artist to pull my changes to the game down add their art elements
and then re-push their changes back up to the cloud pushing just means that you're putting
your changes back on to the cloud server so let's make a new repository and go through this setup
i'll show you guys how to do it so we'll click new and you have an owner so there's obviously going
to be someone who owns the repository and then you have to give it a unique name because this
is also going to be the url that the repository has so i usually just put my name before and then
i can say whatever the name of the project is so i'm going to say vr get demo and then if you
want you can add a description and then you choose whether you want this repo to be public or private
and if you're using any unity assets you have to use the private github or else it'll be taken down
because a lot of these assets you have to buy them and so if they're found on github then you're you
could either be sued or your project will just be taken down so make sure to use private if you're
using any kind of assets from the store and then down here you have a few different files you can
add so a readme is basically just a description of the project and if someone downloads all the
code it's a brief description of this is what the project does this is how to get it running
that kind of thing and a git ignore means these are the files that are going to stay on your
computer but not get pushed up to the server and these are things like metadata files and user
settings and that kind of stuff so they actually have a template set up for unity already so i can
find that and click that and that will go ahead and put in all the unity files that we don't need
in the cloud and then if you're planning on using this project as a more of an open source project
or something like that you can pick to have an mit license or another kind of license just to protect
your project a little more but we're not actually going to distribute this code for this example
anywhere except for our team so we're not going to use a license for this one so let's click
create repository and then you'll see this is the dashboard for this repository so you have
different issues people can mark bugs and that kind of stuff pull request is when you are working
in a team and you want to have like an organized way that people can merge their code back in so
there's no conflicts actions you can use this to set up your build pipeline so if you've heard of
continuous integration continuous deployment this is where you would do that so whenever someone
were to push some code and merge it with the cloud then you could kick off a build and just
get a new.exe file spun up with these actions the projects tab you can use for planning so this
could be your task list you could put everything here so you don't have to have a trello board
and a github you could do it all in this place here you can define your security set those up
insights this is mainly used for teams finding their burn down figuring out how fast they're
going to be able to finish the project and whatnot and then you have a settings and in here you can
also rename this repository as well and add like a image and different things like that so feel free
to explore this just click on all the tabs that's the best way to learn that's how i learned is
just you know do it and then click around see what happens so you'll notice we have two files in here
and uh we want to put our unity project inside of this and in order to do that we need to download
this repo onto our local machine and to do that we need to download github desktop so just
type in github desktop in the search this is not the circle ci one it's this desktop.github.com and
then you download that and after you download it you'll have something that looks like this so we
are currently in one of my repositories that i um for the game that i'm making right now but let's
add a new repository so you can either click on this drop-down and say add clone repository or
we can go up to file clone repository and then we want to do it from a url and then if your account
is linked you can just select the repository you want to download from this github.com so
ours would be the justapebarnet-vr-git demo but if we weren't using let's say github.com as our
repository whatever we could go back to our repository click on this code drop down and then
this url here we could copy that and then paste this url into and this is where it's going to draw
our repo from and then you also need to choose a local path so where you're going to save it
on your computer it pays to stay organized so i'm going to save it in this folder here and then you
hit clone and that will bring the files down from the server so now if you were to go to wherever
that file is you'll see it's been downloaded from the server and we have those two files
here and then you have a dot get hidden file and this basically just contains all of the get code
that handles pushing and pulling different code so let's actually make a unity project and basically
all we need to do is create a new unity project and drop it into this folder so i'm just going
to make a new 2021 project call this one get demo and then we're going to navigate to the specific
folder so we want to drop it inside on the same level where the dot get file is this folder might
actually be hidden for you so you might not even see it but i've got my directory set up so that
i it shows even the hidden folders but anyway we're going to save it inside of the whatever
the repository is called inside of that folder so we'll select that and then hit create so we
have this brand new unity project and you've got a sample scene in there empty but we've added some
files to the folders let's go back into github desktop and you see that you have all of these
files i got added 14 219 changes that's a lot so let's actually uh cut this down a little bit and
to do that we're going to go into our files again and click on your dot get ignore and inside of the
git ignore so these are all of the names of the directories that we want to ignore but actually
we want to remove the slash that's in front of all of them so this will hide anything any folder
called library with a capital l or a lowercase l and anything inside of that folder that's called
library from github and it won't allow it to push so if we save this this is the local git ignore
file and then we go back to github and i just clicked over here in this area you'll see that
we've updated our number of files and it's only 27 which is much better than before so now anything
with the earlier files that don't we don't need to push we don't need to push our library files
at all and so you'll notice that we have a plus sign next to all of the files that we're adding
and then we change to git ignore and if you click on the file you can see the differences
so we removed all of the slashes and it will do the negative sign by all the things that we
removed and then plus sign next to everything that we added and so you could go through and anytime
you change any little thing you can go back through and find out what that change was what
happened and if you need to undo it you can pretty easily inside of a git project so now in order to
put this onto the cloud server we need to do two things we need to do a commit which basically just
is what this is down here so we say since this is the first time we're pushing it we're just gonna
say initial commit and then in the description you can you know say all the specific tasks that
you did inside of this commit or each little step that you made or something like that just
to make it easier for next time if you're going back trying to find which commit did what thing
and what broke something if you have a little description it really helps so we've typed in
initial commit and then we've got this button down here oops little button down here at the bottom it
says commit to main so click on that and we've committed it but we have not pushed it so it is
committed locally on our machine right now but it is not in the server yet and in order to put
it in the server we need to push so we can either press this button right here or up here at the top
push to origin and origin just means the cloud server so now if we go back to our github page
on the internet and refresh you'll see we have the get demo project in here with the assets packages
project settings and user settings all in here which is exactly what we want so let's say we
we go into our project let's open that back up and let's add a 3d cube just in the middle of project
and we save it and now let's go back to git you'll notice that it's logged to change and so you have
all these different values that define that cube that we put in and these are everything that unity
uses to say there's a cube at this location with this size with this color in the spot and we can
create a commit and say we add added a cube and then you can add a description if you want um say
why you added the cube something like that so this should be very short just a couple
words and then your description can be longer and then we're going to press this button down here
commit to main so now we've committed locally and we can't see any changes in the origin yet until
we push so we need to push to origin it's going to make sure there's no conflicts and then when
everything's clear that means that you are synced from your origin and your local file and you could
use different branches so sometimes in bigger projects people will create dev branches so if i
wanted to make a new branch and call it dev could create a new branch and now you have basically two
different version histories running at the same time so i can make all the little changes i need
to make on the dev branch and then merge that back into the main branch and that way we just have the
big updates so 1.0 2.0 3.0 on the main branch but then dev could have the 1.3 4.4 or 1.3.6 and
that's how that whole process works if you want me to do a little more in-depth tutorial about
this kind of stuff let me know i know this isn't particularly vr stuff but it's important to do
for your projects regardless of if you're doing vr projects or if you're just making websites
it's important to do a github version control kind of thing in whatever project you're making
regardless of the type of game or code or whatever it's just it's it's that safety net you know so
you go that's how you add a project to github and you uh prevent your project from dying but
in all seriousness if you like add an asset and it completely messes your project up like if you're
halfway through your game and you're like oh i need this extra asset and then you add it to your
project and it completely messes everything up there's not really an easy way to just like remove
stuff from unity projects it is all intertwined and it gets really complex so if you have this
version control and version history you can go back to previous versions and previous histories
and you can start over from a previous save point is basically what you're doing so think of
version control as adding checkpoints to your game development process and you'll be much happier i
recommend doing a commit and a push every time you complete a task try not to wait too long before
you do pushes so like when you're playing a game every time you do a quick save it's better to do
more quick saves than it is to do um less and then you have to go back way far in the game and redo
a lot of stuff if you end up losing something and you weren't saving regularly so save your projects
locally save regularly you know just in the unity editor but then also commit regularly and push to
the origin branch regularly that way you have this backup in the cloud and that's all i have
for today if you want some more tutorials like this that aren't necessarily vr let me know i'm
down to do whatever i'm still making my game in the background the reason i'm doing this tutorial
is because i had to add my game that i'm making right now to a git repo and i figured you guys
would enjoy learning about how to do this if you don't know how to do it already i know it's not
particularly a vr specific tutorial but i think it's very useful so let me know if you want some
more stuff like this just you know general advice about how to make games and i'll see you next week