How do I commit only working copies to Source Control.

Discussion in 'iOS Programming' started by moonman239, Jun 23, 2014.

  1. moonman239 macrumors 68000

    Mar 27, 2009
    I lost some progress due to a change that I decided to make, and I don't want that to happen again. Therefore, I suppose using Source Control would be a good idea. However, I just want code that works as I want it to to be in the project's repo. That way, if I ever end up breaking what previously worked, I can go back to the latest working copy.
  2. ArtOfWarfare macrumors G3


    Nov 26, 2007
    By having your code unit tested so you know when it's working or not?
  3. JohnsonK macrumors regular

    Mar 6, 2014
  4. MattInOz macrumors 68030


    Jan 19, 2006
    If your using a repository like Git you can branch the code at any point. I think the aim is to get the habit of keeping the main branch for working version then remembering to create a new branch anytime you go and change anything.

    Then when you have it working again in the branch you fold it back in to the main code branch.

    If it turns out the idea you were trying didn't workout you discard the branch.

    You also have the option to selectively submit code changes to repository.
  5. moonman239 thread starter macrumors 68000

    Mar 27, 2009
    How do I do that?
  6. Dekard macrumors 6502


    Sep 7, 2011
    Dallas, Texas
    Is there any decent frontends for git? I've worked with 1 other developer before using git and it works pretty well, but I just got done with Subversion/Cornerstone and it was terrible trying to work with others.. Currently looking for a decent solution for small teams..
  7. mfram macrumors 65816

    Jan 23, 2010
    San Diego, CA USA
    Well, you read about how Git works. It's not magic. You have to specifically decide when your app is "working" the way you want, then you commit it to the source control history. Think of it as a checkpoint. You can go back to that commit later or you can branch off from any commit you've made. The XCode UI presents some thing you can do with git, but not necessarily everything. You may have to use the command-line version to do more advanced git operations XCode doesn't implement.

    When you start a new project XCode gives you the opportunity to create a new git repository. If you already have a project going, then you can still start using git, but you may have to initialize the reposity on using the command-line. I'm not sure.


    I just started using git with XCode sync-ing to a remote respository. It seems to work pretty well. git can be a little challenging to use with a team until you understand it's model of how source control works. It's not a central checkout type model. Instead, it's a distributed patch-sharing model. Both have their plusses and minuses.

Share This Page