Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs or learn how to Submit Your Own Blog Post
At some point of game development, we all need to secure our project away from harm…
So today I am going to teach you how to add your existing work to a Bitbucket repo using SourceTree.
Crossposted on App Goodies
At some point of game development, we all need to secure our project away from harm…
So today I am going to teach you how to add your existing work to a Bitbucket repo using SourceTree.
Before we get started, let’s get to know what version control actually is! (skip this if you already have basic understanding).
Version control (aka revision or source control) is the management of changes to documents, software, complex websites or games. Instead of making backups the traditional way (zipping the WHOLE project), version control tends to save only CHANGES of your project, which makes work faster and more efficient.
The catch is that you can always come back to that change no matter what.
So say you’re testing a new game mechanic. You make the latest commit and get to work. But a while later you realize how dumb this mechanic was. Instead of removing it from the project (hunting down scripts, placeholder models etc.) you can simply revert back to the version you were previously on, removing all changes you’ve made.
While version control is pretty easy to understand, there are some terms you need to know:
Repository – a virtual storage where all your project files and metadata are stored
Committing – creating a commit of changes made to your project
Push – uploading commits to repository (only new commits are uploaded)
Pull – downloading commits from repository (only new commits are downloaded)
Clone – adding a repository to your program (e.g SourceTree)
You can see the whole list of terms here.
Bitbucket allows you to have private unlimited repositories for free (up to 5 users). However, its main weakness is that it doesn’t allow more than 2GB of files in your repository, so if you want more space you can always use Visual Studio Online and Perforce (both are free). If you’re working on a simple mobile project then Bitbucket is a good choice!
Apart from that, Bitbucket has a free program which allows you to manage your repository with ease – SourceTree. This is what we’re going to use to commit, pull and push our changes into our repository!
A BitBucket account
SourceTree
Dummy Project to practice on
First off let’s create a repository to host our project. Go to Bitbucket > Dashboard > Create > Create Repository
Fill out the details (name, description, etc).
I would recommend choosing Git as your source control, as it feels faster than Mercurial, it may just only be me, but another reason to choose Git is because it’s more common among developers.
Once your repository is made go to SourceTree press “Show Hosted Repositories” button (located at the bottom left).
A window will pop up. Click “Edit Accounts” located at the top right.
Press Add. Fill your bitbucket.org account credentials and press OK.
Wait for the list to update. You’ll see your newly created repository! Double-click it and you’ll be given an option where to clone your repository.
Note: I would recommend you to clone your repository into a directory where your current project is located – just to keep things clean.
Select your desired directory where you want your repository to be. Give it a name (will be displayed in SourceTree) and press Clone.
You should see that your repository has been added to the list on the left hand side. Congrats! We have finished with our Repository!
Open Unity and select your project.
Once your project is loaded, go to Edit > Project Settings > Editor.
Set Asset Serialization Mode to “Force Text”.
Edit: Thanks to Simon (darkside) Jackson pointing out that you must make sure that Version Control Mode must be set to “Visible Meta Files”
Once you’re done. You can now close Unity!
Locate your Unity Project and drag it to the directory your recently cloned repository is residing. It’s best if you drag Unity Project contents instead of the whole folder to avoid confusion in the future. You can now remove your original Unity project since it has already been copied to the new directory.
Before closing folder, download this Unity .gitignore file. This will enable SourceTree to ignore files with certain name extensions, which are not needed to be backed up. Put it into the root of your project like so:
Open the Unity and you’ll see that your Project is gone. No worries! Click “Open” and locate your new version control ready project and open it!
Congrats! Your project is now working with source control. Now let’s learn a bit more about SourceTree.
Open SourceTree. You’ll see that it has automatically detected which files has been added, modified or removed. Pretty sweet!
Check all unstaged items and you’ll see they’re all moved into staged items. That means these files will be included into our first commit.
Before we actually commit, enter a commit message at the bottom right. Include stuff like changes you’ve made, or bugs you have fixed etc. But since it’s our first commit, I would simply add “Initial commit”. Make sure you’re in File Status tab.
Finally, press Commit. This process can take several seconds to a few minutes (or even hours) depending on the size of your whole project. Another commit will depend on the size of CHANGES you’ve made to your project. Same process happens with “Pull” and “Push”.
Once you’re done you’ll be moved to the main view of SourceTree. It shows a list of all latest commits.
Now we need to “Push” our repository online – best place to hide your repo from unwanted fire and explosions!
Press Push > OK and wait while your project is being uploaded online. (time duration varies by project size and your internet connection).
Once it’s done it’s done! You can now see your commit in the main dashboard of your Bitbucket account.
Congratulations on completing this tutorial! Hope it was helpful!
Found any errors? Tutorial too confusing? Tutorial requests? Let me know in the comment section below.
If you enjoyed this article then be sure to check out my blog for more of these!
Read more about:
Featured BlogsYou May Also Like