Really remedial question about saving programs in xcode

Discussion in 'Mac Programming' started by eacron, Dec 15, 2010.

  1. eacron macrumors newbie

    Joined:
    Nov 1, 2010
    #1
    Hi,
    I'm a beginner in learning C (using Masters of the Void) and can't seem to find an answer to this problem. In learning C I've created a project which is basically where I code the programs from the tutorial. The thing is as I get more advanced the original program goes through some changes but each time I run and build I essentially write over the previous version of the program. My question is how do I save a version of my program? Do I have to have a separate project for each version of the program? I feel like it should be like photoshop where I keep adding layers to my program but am able to go to the previous layer and not loose previous versions of the same program. I've searched for help in this but either I searched wrong or I'm just completely ignorant in something. Anyway, any help with this will be greatly appreciated.

    Eli
     
  2. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #2
    About the best way to really do this would be to set up and use an SVN repository. It is built into Xcode and it will allow you to keep complete changelogs of your entire project. If you aren't comfortable enough in setting up your own, you could just use a third party like http://www.assembla.com/, which I've used before and is pretty painless. Otherwise about all you can do is make a copy of your project folder, zip it up and call it something like MyProjectV1.0.zip
     
  3. eacron thread starter macrumors newbie

    Joined:
    Nov 1, 2010
    #3
    Thanks for the suggestion... I'll definitely look into it. I have to say I'm surprised its not built into xcode. What do you do for instance when your working on a program, constantly moving things around and you realize you want to go back a few builds because the program ran better that way. All that information is lost?! I've gotten to the point where every time I do a "build and run" I save the code first in text editor each time as a different file. Its driving me nuts but at least I have all that information.
     
  4. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
    The problem is that there are MANY different source code management/revision control systems. RCS, CVS, Subversion (SVN), Perforce, Git, ... Which one should be built in? Xcode provides hooks to at least CVS, SVN and Perforce.

    I concur with ulbador that using a hosted SVN service (even a free one) is probably the way to go. I use Beanstalk http://www.beanstalkapp.com/ myself.

    B
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Every night, use Finder to make an archive of the project folder. Name it something with the date in it, like Proj-2010-12-15.zip. Move or copy this to another folder, where the history of archives will remain.

    In any given day, before making any major restructuring, quit Xcode and do the above procedure. This is making a checkpoint of a known-working project, before any restructuring occurs. Move this to your archive folder, too.

    If it's a really major restructuring, do it in stages. Make some changes, get it working, make a checkpoint. Make more changes, get it working, another checkpoint.

    The advantage of this approach is you don't have to learn SVN, or suffer through Xcode's occasional hiccups with version control. Either way, it's up to you to exercise the diligence of making an archive or checkpoint. SVN doesn't automatically checkin anything, so you can still hose yourself if you're not careful.
     
  6. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    Wouldn't more than that level of archiving just be handled automatically by Time Machine? You get ~hourly snapshots and can go back in time to any given point if need be with a nice, easy-to-use GUI interface.

    What you don't get, that you do get from SVN, is easy diffs and tags of why you may have gone down a particular path.

    (I agree that it's something else to learn and requires discipline, but IMHO it is well worth it).

    B
     
  7. eacron thread starter macrumors newbie

    Joined:
    Nov 1, 2010
    #7
    Thanks guys for all the suggestions! Well I'm glad I got this sorted out for the most part. For the time being, at least until I get more proficient, archiving sounds really good. I've been kind of doing that anyway but in an really archaic way. I think the way you suggested was much more organized. In the mean time I'll check out some those other options (svn, etc...). Thank you all for the helpful suggestions!

    E
     
  8. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #8
    XCode, File Menu, "Make Snapshot".
     

Share This Page