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 : www.bitbucket.com
Configuring Your Machine
- Open up your Unity Project.
- Click Edit/Project Settings/Editor.
- Change Version Control to Meta Files.
- Change Asset Serialization to Mixed.
- Sign Up to BitBucket.
- Create a Repository.(BitBucket will guid you its pretty easy.)
- Install GIT with the default parameters.
- Install Kdiff with the default parameters.
- Open Git GUI (search in windows search.)
- Click on Clone Existing Project button.
- Type https://< -username- >@bitbucket.org/< -username- >/< -project name- >.git into Source field.This can be found on BitBucket overview page near HTTPS button.
- 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.)
- Click Clone Button.
- It will take a while,take a Coffee !
- Bonn Appetite ! Now click on Edit/Options from the top menu bar.
- Enter your BitBucket user name and E-mail to the appropriate fields.
- Type kdiff3 into the Merge Tool fields.
- Save and Close.
- Navigate to your local Repository folder from Windows Explorer.
- Show hidden files from the settings.
- You will see a Folder named .git.Open that folder.
- Edit config file and add following lines to it;
- [mergetool "kdiff3"]
path = C:/Program Files (x86)/KDiff3/kdiff3.exe
keepBackup = false
trustExitCode = false
postBuffer = 524288000
- Replace path with the Installation folder of Kdiff.
- Done ! You Git is Ready to Use !
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 ?
- Open Git GUI.
- Click On Commit/Rescan from the top menu.(This will detect changes from the last time.)
- Now, Click on Commit/Stage Changed Files.(This will mark your changes to be Committed.
- Fill out the Description box below.Git GUI will warn you anyway.
- Click the Commit button near the Description box.
- 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?
- Open Git GUI.
- Click on Remote/Fetch to download changes to your local Repository.
- Waiting is a virtue!
- After Fetching is completed Click on Local Merge.
- Select Tracking Branch.
- And find the branch that you want to merge with.
- This operation will open kdiff3 if any conflicts has been found.
- You should solve the conflicts by using kdiff tool to select correct one or merge the files manually by hand.
- That’s it you are done !
Create a New Branch ?
- Open GIT GUI.
- Click Branch/Create.
- Fill in the name field.
- Select Tracking Branch and Select the Branch which you want to create sub Branch from.(Probably master/origin)
- Click Branch/Checkout and Select the new Branch from the List.(This will switch your current branch to that.)
- Make your changes.
- Click Commit/Rescan
- Click Commit/Stage Changed Files To Commit
- Fill the description as explained before.
- Commit from the bottom of the window.
- Push the changes.
- 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 ?
- Login into BitBucket website.
- Click on Pull Request button from the Project page.
- Select the Branch you have finished working on, on the left side.
- Select the branch which you want your work to merge into, on the right side.
- Enter a title and brief description of what you changed. As detailed as possible.
- Click Create Pull Request
- 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.
- 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.