22 Temmuz 2013 Pazartesi

Unity, Dropbox and BitBucket

Story Behind


In this post,i will talk about how we have moved our project from DropBox to BitBucket.You might have questions popping in your mind asking whats the common point of BitBucket and DropBox ? The very first reason why we wanted to use DropBox was having backups and able to always be in sync.And we were lazy create a Version management system.

When we have first started this project with my team we didn't put a lot of thought on how much space it would require to maintain a Game project on DropBox.Me and my Graphic designer had a lot of space on DropBox,so It seemed like a good idea.Well it wasn't ! The current size of the project for a 35mb game is more than 24gb with all of its backups,builds etc.We might have deleted some of our old Source Codes and Builds but i am a bit emotional about that.I do like to see how this project moved on from the very beginning untill the 0.8g which is the current version(Here is the Twitter page if you are interested.We are coming Soon !. Link)

After struggling a long time with the limited space and conflict issues on DropBox (Which is normal,it was a Cloud service not a Version Control tool after all.) we decided to move on to a better system.That's where i started make a research about how ?

After a little bit of research i found that BitBucket to be a treasure.Free up to 5 people, no size limitations...I thought they should be crazy to offer that stuff for free.I started installing GIT,KDIFF and other stuff to make the system working.And luckily i have created a small Guide for my team mates which i will share with you too.

How to Start Using BitBucket 

As i said I'm not an expert on GIT or BitBucket.Those are the notes that i have been taking while i was preparing the system.And they have worked fine so far for me and my team mates.By following the below steps you can easily(wasn't very easy for me tho) prepare your own version management system.

First things first,download the following software and get an account from BitBucket(There are other services such as GitHub etc too but im not going to talk bout them.Process should be similiar.)

BitBucket :

Configuring Your Machine

  1. Open up your Unity Project.
  2. Click Edit/Project Settings/Editor.
  3. Change Version Control to Meta Files.
  4. Change Asset Serialization to Mixed.
  5. Sign Up to BitBucket.
  6. Create a Repository.(BitBucket will guid you its pretty easy.)
  7. Install GIT with the default parameters.
  8. Install Kdiff with the default parameters.
  9. Open Git GUI (search in windows search.)
  10. Click on Clone Existing Project button.
    1. Type  https://< -username- >< -username- >/< -project name- >.git into Source field.This can be found on BitBucket overview page near HTTPS button.
    2.  For Target field choose a local folder to be synced with the BitBucket repository.(You might want to create structure like "Repositories/Project-name" to be able to add future Projects without cluttering.)
  11. Click Clone Button.
  12. It will take a while,take a Coffee !
  13. Bonn Appetite ! Now click on Edit/Options from the top menu bar.
  14. Enter your BitBucket user name and E-mail to the appropriate fields.
  15. Type kdiff3 into the Merge Tool fields.
  16. Save and Close.
  17. Navigate to your local Repository folder from Windows Explorer.
  18. Show hidden files from the settings.
  19. You will see a Folder named .git.Open that folder.
  20. Edit config file and add following lines to it;
    1. [mergetool "kdiff3"]
       path = C:/Program Files (x86)/KDiff3/kdiff3.exe
       keepBackup = false
       trustExitCode = false
    2. [http]
      postBuffer = 524288000 
  1. Replace path with the Installation folder of Kdiff.
  2. Done ! You Git is Ready to Use !

Push,Pull... ?


Don't worry we don't have to do actual pushing and pulling ! But you have to get used to those terms to able to use GIT.
  • Push : Means you are sending your changes to the server.
  • Pull : Means you are downloading changes from the server and merging them with your local project.
  • Fetch : Means you are downloading changes from the server but not merging them yet.
  • Branch : Hmm... Think your BitBucket as a Tree.The main project is Master.Then as you progress in your project you may want to create Branches to develop new Features independently.Then at the end you can merge those branches back in to the Tree.

How to Commit Your Changes ?

  1. Open Git GUI.
  2. Click On Commit/Rescan from the top menu.(This will detect changes from the last time.)
  3. Now, Click on Commit/Stage Changed Files.(This will mark your changes to be Committed.
  4. Fill out the Description box below.Git GUI will warn you anyway.
  5. Click the Commit button near the Description box.
  6. Click on the Push button to actually send your changes to the sever.(For now just say ok the dialog box.)

How to Get Changes From the Server?

  1. Open Git GUI.
  2. Click on Remote/Fetch to download changes to your local Repository.
  3. Waiting is a virtue!
  4. After Fetching is completed Click on Local Merge.
  5. Select Tracking Branch.
  6. And find the branch that you want to merge with.
  7. This operation will open kdiff3 if any conflicts has been found.
    1. You should solve the conflicts by using kdiff tool to select correct one or merge the files manually by hand.
  8. That’s it you are done !

Create a New Branch ?

  1. Open GIT GUI.
  2. Click Branch/Create.
  3. Fill in the name field.
  4. Select Tracking Branch and Select the Branch which you want to create sub Branch from.(Probably master/origin)
  5. Click Branch/Checkout and Select the new Branch from the List.(This will switch your current branch to that.)
  6. Make your changes.
  7. Click Commit/Rescan
  8. Click Commit/Stage Changed Files To Commit
  9. Fill the description as explained before.
  10. Commit from the bottom of the window.
  11. Push the changes.
  12. From now on any changes you are making here will take a different path from the main project. And at one point we will merge those to branches into one.

How to Request a Pull to Merge the Branch ?

  1. Login into BitBucket website.
  2. Click on Pull Request button from the Project page.
  3. Select the Branch you have finished working on, on the left side.
  4. Select the branch which you want your work to merge into, on the right side.
  5. Enter a title and brief description of what you changed. As detailed as possible.
  6. Click Create Pull Request
  7. After that, Team Members will check this Pull Request and if it does not create any further problems they will approve it to merge with the Main Project.
  8. To approve a Pull Request you need to have Admin rights on the BitBucket.Than you can navigate to Pull Requests page select the new Pull Request and accept or decline it.