Before you can use git you'll need to run the git init command in your project. After you set up a project under git you'll be able to track each of your changes and save them correctly.
- [Voiceover] Now in order for us to start testing out how to use Unity Cloud Build, we're gonna need a project. I've already gone ahead and taken the final project from my Unity 5 2D Essential Training course and included it in your exercise files folder. We'll be using this as our test project. Once you have it downloaded, we'll want to find it on our desktop. Here you'll see the entire game. Next, we're gonna want to add it to our GitRepo.
Let's go ahead and find Terminal. From here we're gonna type in cd, space, and drag the project folder onto the Terminal window. On OSX, you can get the path to any directory by simply dragging it into the Terminal window. cd is the command that allows us to change a directory. If you're on Windows and you've installed GitBash, you should have an option to right click in a directory and select GitBash here to open up the bash at that directory.
Or you can always type in cd and the path to the folder you want to be in. Let's hit Return. Now, you could see on the left of my name here it says SuperZombieRunner, and that I'm on my Mac. If I type in pwd, you can also see the working directory. This way we can make sure that we're in the correct directory before we try to create a git-repo. You can clear the commands in the Terminal at any time by typing in clear and hitting Return.
Now, let's go ahead and create a git-repo. We'll do this by typing git init Now we have our first git repository. If we go and take a look in the Finder, you won't see anything different about your folder. But let's go back in the Terminal. If you type in ls, you'll be able to see a listing of all the files in the directory, and this should match what you see in the Finder. But if you type in ls -a you'll see a listing for all the files, including the hidden ones.
On a Mac, you'll see the .ds store file, and now we'll be able to see our .git file. But this really isn't a file, it's actually the directory, and the .git directory is what stores all the information about our git-repo. Unlike SVN, which keeps a .svn folder in every single directory, Git keeps all the information at the root of your project. That means it's easy for you to move files and folders around and not worry about breaking the link between the version control and your project state.
Any time you make changes, you'll need to track those changes and commit them back to the repo. Let's go ahead and clear Terminal and take a look at what's in our project. If we type in git status, you'll see all the files in your project that are either tracked or un-tracked. Since this is a new project, all the files are un-tracked, and they should show up in red. Now we have our basic git-repo, and we can check the status of the files inside of our repo.
- Setting up Unity Cloud Build, Bitbucket, and Git
- Creating a .gitignore file
- Committing and pushing changes
- Connecting to Unity Cloud Build
- Creating new Unity Cloud Build targets
- Merging project changes
- Optimizing a Unity Cloud Build workflow