Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Version Control, You, and why You need Version Control

Discussion in 'General Discussion' started by AndrewGrayGames, Nov 14, 2013.

  1. jaybennett

    jaybennett

    Joined:
    Jul 10, 2012
    Posts:
    165
    I used Perforce at work, but I'm just deciding today to move from Dropbox to a real version control at home. I think peoples' biggest problem with version control is the learning curve, so I'll stick with Perforce. Its free for home use (and up to 20 others) and the visual client is pretty good too.

    Of course, I'm running the Perforce repo service on my local machine, with no static IP, so its pretty limited by that. But I'll probably still back up the repo data on Dropbox instead of just my local HDD :)

    When in doubt, go with what you know.
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,526
    I do not. It's a general statement somewhere about the intent of the service being to host code, and that they reserve the right to close repositories that deviate too far from that. I also missed it at first.

    In another thread here someone just a few days ago posted that they were contacted by Bitbucket about exactly that, but they were cool with it as long as a paid subscription was used. That user has since moved to Unfuddle, which is coincidentally also where I recently moved. Pretty similar service, but they have game developers in their list of clients and give actual storage volume figures.

    For what it's worth, I moved before finding out that BitBucket are potentially cool with games on paid accounts, and if I'd known that I'd probably have stuck around since I did find it a pleasure to use. Unfuddle is also pretty cool, though, no complaints there.
     
  3. BeefSupreme

    BeefSupreme

    Joined:
    Aug 11, 2014
    Posts:
    279
    Ah, I see. Thanks for the heads up. Might give Assembla a shot then (looking for free private hosting).
     
  4. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    It would depend on the definition of large. Do they mean 10GB video files? In typical unity project, your biggest assets would be some fbx files and mp3/wav which would require just a few megabytes.

    Of course, each project is different.
     
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,526
    My impression - unconfirmed - was that it was referring to anything that wasn't text-based. Binary stuff is handled differently to text stuff in most (all?) VCSs, and takes up many times more space.

    Their example was that if a repo was more than 1gb in size then you're almost certainly not doing things the way they expect. For a game project a 1gb repo isn't particularly large.
     
  6. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,618
    No, it's textures - if you're trying to ship a high-res desktop game then you'll have a lot of 4096x4096 textures knocking about, which can eat 10+ MB each - and scene files themselves (my main level's scene file is around 200MB).
     
    AndrewGrayGames likes this.
  7. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    All vcs systems can handle binaries fine. What they will not do is merge changes in binaries. Some example will clarify this:

    Suppose you have a .cs script. You modify lines 10-20 and someone else in your team modifies line 50-60. Any half decent vcs will merge both into a file that contains yours and your partner's changes. This allows many people to work on the same file simultaneously as long as they work on different parts of it. If you both modify the same section, it creates a "conflict", which you can resolve by editing the file and fixing it manually.

    Typical vcs only do this merging for text files, they will not do it for binary files. That is all the difference between binaries and text files.

    You typically don't want the vcs to track your compiled files, you only want the vcs to track source files. You would want to track textures, fbx, mp3 and other binaries as long as they are not generated by your build process. Just know that the vcs will not help you if 2 people work on them at the same time.

    I agree 1gb is rather small for game development, whether you are using it right or not.
     
  8. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,526
    Exactly.

    I didn't say VCSs can't handle binary files, I said they're handled differently, and it makes a huge difference to resource usage.
     
  9. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
  10. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    I would disagree with this, git really tanks performance wise once you get a fair number of large binaries in it, which is common in games. (I currently use git myself however)
     
  11. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I was using Plastic SCM's free community edition with Visual Studio Online using Git. Visual Studio Online is great because the repository sizes are currently unlimited, whereas bitbucket.org has a 2GB limit.

    However, now I'm using Plastic SCM with an Azure Virtual Machine as my remote repository all for free (through BizSpark). Plastic is designed for game development and has the ability to handle large file sizes. I find its interface more intuitive than SourceTree as well.
     
  12. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Hey Koridian, I looked into Plastic SCM and it seems like its all free there.
    Can anyone suggest best free version? I was also looking into GitLab. Is Plastic better?

    Could you also explain a bit more about Plastic and BizSpark?
     
  13. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    tigerija,

    Plastic SCM is its own version control system. They also have a plugin for Unity, but it's quite expensive to use and currently it requires a Team License for Unity to use. You can, however, use their free community edition (free up to 15 users) and set it up with your own server (another computer/laptop), so that you can have a local copy of your repository on your computer, as well as a remote one on your server.

    As of now, I haven't found any cloud hosting services which host Plastic SCM, and I think they're looking into creating their own. Although Plastic SCM is its own version control system, if you'd like to use one of the existing services like BitBucket or GitHub or GitLab, you can use Plastic SCM's GitSync utility to sync your repository with a Git repository on one of those services. That way you can use Plastic SCM's nice GUI with Git.

    BizSpark is Microsoft's program for software development startups. You get access to all their software (like the pro versions of Visual Studio) for free for 3 years, as well as $150/month credits towards their Azure cloud services. If you qualify for their program (the requirements are on their website), it would be best to apply through a Microsoft tech advisor, as they can pre-qualify you through the program so that you don't have to go through Microsoft's approval process. In some cases, by going directly through Microsoft's approval process, people seem to have been rejected even though they met all the requirements, so I'd recommend finding a Microsoft tech advisor to apply through.

    You can find the Microsoft tech advisor closest to you here. Tell them a little bit about yourself and your company, and hopefully they'll send you a link you can use to apply. Just make sure you meet all the requirements.

    All the best.
     
  14. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Ok. I was not sure if Plastic SCM also includes server or you need to have your own. Was confused about that part. But it seems like you need your own server.

    I will try GitLab since it seems like it gives you version control and server for free. Had server before with Redmine+SVN.
    BitBucket also seems alright. But its only up to 5 members. What might be fine. But I'd rather be safe. Up to 10 would be great I'd say.

    GitHub seems like being most popular. Tho it is not free for groups. Alltho price is not expensive, 7 bucks a month, I am just looking for some free alternatives for time being.
     
  15. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Hm, seems like GitLab is great free option if you are going for Git. But after some research how git works I would prefer SVN. I don't like that extra step Git has.

    Anyone could suggest some free SVN+Server options?
     
  16. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    I would advice against using svn, nowadays it is flat out obsolete ( I happen to be the svn administrator at my company, and would still not use it if I had a choice ).
    If git seems a bit complicated, then I suggest mercurial, the commands are very similar to svn, but it is fully distributed. This means that like git you can do stuff like commit, branch, revert, browse the change log, etc... without having to be online. Also, merging branches is really painful with svn, mercurial is much more graceful. The main caviat is really unity, since the way it stores scenes is not very friendly for svn, mercurial or git, so branching is of limited use for us unity devs.

    You can use bitbucket + mercurial, or bitbucket + svn for free. Some people pointed out some concerns with repository size. Reading gitlabs TOS, they have the same restriction (1gb size)
     
    Last edited: Aug 22, 2014
    angrypenguin likes this.
  17. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    One thing to note, is that if you use git or mercurial, and they shut down your account, you still have your full repository with full history in your machine, so you would just reimport it with another provider and you are all set
     
  18. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Hm, why is SVN bad?
    Part I dont like about Git is that you commit to your local copy.
    To me it feels like things pile there and then you commit to server.
    But this is does not sound safe since people might mess with files you are working on.

    How does mercurial work? EDIT: Researched.

    GitLab is 1gb yeah. Tho you can have several with 1gb.
    Bitbucker is only 5 members. We are less at the moment but I would like to keep it around 8 to be safe.
    Are there any 1gb+ with ~10 members? Mercurial possibly.
     
    Last edited: Aug 22, 2014
  19. BeefSupreme

    BeefSupreme

    Joined:
    Aug 11, 2014
    Posts:
    279
    That's a good point. I went ahead and made a Bitbucket account yesterday, as trying to find a host was becoming entirely too frustrating. My current project is in 2d and comes in under 50mb, so I doubt it will get flagged, and even if it does, so be it. I'm just working by myself anyway, so it doesn't really matter.
     
  20. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Flagged?
    And doesnt bitbucket provide hosting as well? Up to 5gb.
     
  21. BeefSupreme

    BeefSupreme

    Joined:
    Aug 11, 2014
    Posts:
    279
    Yeah. See earlier discussion in this thread about Bitbucket not liking free accounts with large amounts of binary data.
     
  22. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I believe Bitbucket's latest size limitations were posted here:

    http://blog.bitbucket.org/2014/05/30/repository-size-limits/

    There's a soft limit of 1GB, and a hard limit of 2GB. In the comments, they wrote the reason for introducing the limitations:

    "The primary motivation to implement repo limits to protect the service from run away repos that are causing havoc on performance. Right now only about .01% of repos are over the 2GB limit and are mostly from individual users for non-code projects such as storing MP3s or movies."

    Here's another link to more detailed info about their repository size limitations:

    https://confluence.atlassian.com/pages/viewpage.action?pageId=273877699
     
  23. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    If you want a longer and condescending explanation, check out Linus presentation:


    I have much more experience with mercurial and subversion, but pretty much anything I say about mercurial has equivalents in git. Here is my take on it:

    Update in subversion:
    svn update (must be online)
    Update in mercurial:
    hg pull
    hg update

    commit in subversion:
    svn commit -m "some message" (must be online)
    commit in mercurial:
    hg commit -m "some message" ( works fine offline)
    hg push

    If you simply follow that equivalency, the "piling up" is exactly the same. You will notice it takes 2 commands to update/commit in mercurial vs 1 in subversion, but this deserves an explanation. Every working copy in mercurial also includes a full repository with full history. The commit command takes the current changes, and adds them to the underlying repository. You can commit as much as you want, and all the changesets will pile up in your local repository. At some point, you might want to send your changes to some server so other people can see them, that is when you do a push.

    Consider operations like "svn log" and "hg log". "svn log" will go to the server and check what changesets have been committed. "hg log" will look at the changes that are in your local repository. "svn log" only works if you are online, and it is _much_ slower than "hg log". This helps if you are on a plane for example. The same goes for operations like branching, merging, reverting changesets, tagging

    Why do you care? Here is how I use it: I have several repositories for the same project. one for ios, one for android, one for pc. If I commit something in the ios one, I can simply pull it into the others, so they are kept in sync, even while on a plane. I also don't have to worry about breaking things for other people in my team since I get to decide when the changes are pushed to the server, even though I make lots of commits. This means I never have to wait for unity reimports when switching platforms
    In subversion, I would keep several working copies, but to synchronize them, the changes have to go to the server (require online access) where they might affect other people.

    Another big deal to me: If bitbucket decides to cancel my account, I am fine, I would simply reimport my repository into some other service. There is not a single point of failure. Every working copy is a full backup of the entire repository. With subversion, if the server dies the entire history is lost. You have to worry about backups, which are insanely awkward with svn.

    In mercurial you add, delete and move files with:
    hg addremove
    In subversion, you have to add, delete and move one at a time. TortoiseSVN really helps though.

    Merging in mercurial is painless. It figures out what changesets have not been merged, and merges only those. svn is really bad at this, recent versions keeps track of revision numbers between merges, but this tracking is brittle, and it gets easily confused if you move files and folders around. svn has gotten better over the years, but it is still nowhere near as easy as mercurial or git.

    subversion keeps internal data in each subdirectory. Move a subdirectory and it becomes a complete mess unless you know what you are doing. Mercurial keeps all the repository in a single .hg folder at the root, so it does not mind you moving stuff around.

    mercurial is much faster. Most operations are local.

    I would say there are 3 generations of vcs ( and I have suffered them all):

    First generation is the lock-edit-commit type of tools like rcs, source safe, clearcase. You normally lock the file, do your changes and then commit (which releases the lock). This is ok for small teams, but it does not scale. Things like someone locking and going home disrupts the whole team. Things only work online and is highly centralized. If you have to work with any of these, just get another job.

    Second generation is the centralized edit-merge-commit tools like cvs and svn. Allows for concurrent modification of files, but most operations require online access, single point of failure, etc... These were very popular in the 90's and early 2000. Still a major improvement over the first generation tools. Lots of large corporations still use svn mainly because of inertia.

    Third generation is the decentralized version control systems like git, mercurial, bazaar, bitkeeper. These scales better both up and down. From the individual with a quick project, that does not even need a server ("hg init" and you are ready to go), to projects with thousands of people like the linux kernel. There is a reason so many open source projects have been moved from subversion to git.

    I have worked 10+ years with subversion as an admin and user. I can honestly say I have not found a single thing that subversion can do better than mercurial. While there are plenty of things that mercurial can do better, faster, or that subversion can't do at all.
     
    Last edited: Aug 23, 2014
  24. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    Thanks for the explanation. So you have several repositories for the same project not branches within a repository? You can commit changes across repositories? I'm new to all this and just trying to figure out how it works.
     
  25. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    You have branches too.

    The main difference is that it is distributed.


    There is no single authoritative repo - all repos can push and pull from each other.


    That being said, both perforce and plastic are better for large projects with binary files.

    And they are pretty much free now too.
     
  26. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,526
    Isn't plastic a front-end only, that sits on top of Git or Merc anyway?

    @BeefSupreme, I had a look at the bitbucket site again and it looks like they've updated the vague thing I read into the more detailed stuff Korindian linked to.

    While it was an older version of the article, this...

    ... combined with this ...

    ... gave me the impression that, as great as their service is, it's not an ideal fit for what I was doing. After all, a game project is a perfect candidate for having far more image, audio and similar binary-stored data and reaching a repo size easily over a gigabyte.
     
  27. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Perforce hosts for free for up to 20 users? Or I got it wrong?
     
  28. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    Yes, multiple repositories, not branches. Here is the workflow:

    I clone the repository 3 times:
    Code (csharp):
    1. hg clone https://bitbucket.org/...     blockstoryios
    2. hg clone https://bitbucket.org/...     blockstoryand
    3. hg clone https://bitbucket.org/...     blockstorypc
    So now I have 3 repositories containing the same thing. In the blockstoryios one, I compile for ios, in blockstoryand I compile for android and blockstorypc I compile for pc. The idea is that I never have to reimport all assets when switching platform. Instead I open the right repository in unity, which is much faster.

    Now, If I change something, I want all 3 repositories to have the change. Suppose I change something in blockstoryios, then I:

    Code (csharp):
    1. cd blockstoryios
    2. hg commit -m "description of my change"
    3. cd ../blockstoryand
    4. hg pull ../blockstoryios
    5. hg update
    some explanation: the hg commit, take my current changes, and adds it to repository that blockstoryios has. At this point, it has 1 changeset that the other two don't.
    the pull, takes any changeset from the ios repository, and adds it to the blockstoryand repository.
    finally hg update applies the changes to the actual files I work with in blockstoryand.

    When I am happy with the changes, and want to send them to the server, I simply do:
    Code (csharp):
    1. cd blockstoryios
    2. hg push
    By default push will send the changesets to the repository this was cloned from, but you can specify what repository you want to push the changes to, so you could push to a different folder, which is the same as doing the pull from the other folder.

    If I wanted to know who has changed what when, I can simply type:
    Code (csharp):
    1. hg log
    and it lists every changeset in order.
     
  29. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    Perforce is a server program you run on your own server (unless you pay for a service they sell). That program has a 20-user free version.
     
  30. BeefSupreme

    BeefSupreme

    Joined:
    Aug 11, 2014
    Posts:
    279
    I could totally see that not working out for larger projects. If mine ever gets that size, I'll start shopping around. Too bad there aren't more choices for free hosting, but you gotta take what you can get.

    Still haven't installed anything yet, got side tracked with creating an asteroid belt this weekend =p

    Ps. Master Thief looks cool, nice work!
     
  31. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Is there any free SVN hosting for private groups? I really hate git (gitlab). Its almost impossible to set up tortoiseGit. And Uploading and downloading is too complicated compared to SVN. Yes I know about more features. But it comes with more responsibility and complications.
     
  32. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    bitbucket gives you free private SVN hosting. However, notice the warnings in this threat about repository size.
    Unlike with git, if they cancel your account you are screwed, or will have to pay. So chose your provider well.
     
  33. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    It really looks like you hate TortoiseGit, actually. Try SourceTree.
     
  34. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    I hate SourceTree even more. I loved TortoiseSVN.
    Yeah, I wont use Bitbucket coz some said it can close your repo.

    My biggest issue is that Git has local repository. And I have to commit to local repository. Then push to main server. But things get complicated when it comes to pulling and merging. Sometimes it seems like I get random errors with no explanation.
    I have nothing against Git. And I understand how it is better than SVN. But SVn is good enough for me since it is more simple to use. 1 button push, 1 button download. If someone screws, you can revert. Most files are binary anyways.

    I am also having tons of problem with setting TortoiseGit for GitLab (seems like best free choice).

    Is there some video that explains git workflow for dummies? I mean there is pull, push, commit, merge, fetch...

    Thanks all :) .
     
  35. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    937
    I couldn't bear with TortoiseGit either. As a new guy to version controlling, everything just didn't seem logical to me. So I uninstalled git and TortoiseGit. A few months ago I decided to give mercurial and Sourcetree a shot. Works way better for me the fact that the UI was a bit more centralised was more understandable.

    At the moment I'm still not really comfortable with branching and merging though. So I'm considering to try git with sourcetree. Any experience with that? Sometimes I think that the interface of Sourcetree comes a little too short, looking at the git docs and the available features.
     
  36. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,618
  37. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    I did it like that as well.

    Hey, I have a problem with tortoisegit. We are setting it up for friend of mine. And when he tried to pull for the first time it just hangs there.

    We did it like this: https://help.github.com/articles/generating-ssh-keys
    On gitlab.

    Generated ssh. Copied it from id_rsa.pub . Added persmissions on gitlab. And nothing. Anyone got any idea? :S
    This is so frustrating...

    Thanks.
     
  38. tigerija

    tigerija

    Joined:
    Mar 26, 2012
    Posts:
    60
    Tortoise interface is great yea. But git is what is complicated. SourceTree lacks on interface side, I agree.

    Only problem I have with TortoiseGit + GitLab is setting it up. Cant make it to work :S .