Snapshots vs Git in Xcode

Discussion in 'iOS Programming' started by MacMan988, Mar 29, 2014.

  1. MacMan988 macrumors 6502a

    Joined:
    Jul 7, 2012
    #1
    Hi, I've been reading about the snapshot feature in Xcode and the ability to create local git repositories. Are those two things the same? If not, aren't they supposed to do the same thing? Which method is more reelable when it comes to having previous "known good states" of the project?
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    They have some overlapping purpose, but they aren't the same and they weren't made to solve the same problems.

    Git allows you to do things like merge multiple commits together. This means that if you're on a team of 2 or more people, everyone can edit the same files and then have all their code merged together.

    I'd suggest learning how to use git properly. Don't use a git program with a GUI - those are inevitably too magical and then break and leave you in a state where you don't know what to do. Just use git from the terminal.
     
  3. MacMan988 thread starter macrumors 6502a

    Joined:
    Jul 7, 2012
    #3
    Thanks for the reply. I'm a bit familiar with SVN and the concept behind it. Haven't used git before though. I'm gonna take your advice and get familiar with using git through the terminal.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
  5. MacMan988 thread starter macrumors 6502a

    Joined:
    Jul 7, 2012
    #5
    Hi, thanks for the reply. I followed the guide you have posted and some more tutorials and got my Xcode linked with a GitHub repo too. Although, one thing that that I couldn't find is how to create a gitignore file and add it to the GitHub repo. How do I add a gitignore file to the GitHub repo? Should this be done at the initial commit? What if I add the gitignore file at a later point?
     
  6. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    You can add gitignore later, the problem is that if you already uploaded files that should be ignored, it's a pain to get them removed from the repository. It's best if you handle the gitignore from the very beginning. Make sure to remove videos - those are huge and nearly useless on git, and will very quickly eat up your available space on GitHub.

    (I accidentally uploaded a 10 minute video to GitHub at work one time. Nobody was able to access GitHub within the office for ~15 minutes while it uploaded. It was embarrassing to admit that I caused that problem. So consider yourself warned now).
     
  7. MacMan988 thread starter macrumors 6502a

    Joined:
    Jul 7, 2012
    #7
    If the files that should be ignored are committed to the local git repository, but then the gitignore is added later but before pushing the first initial commit to GitHub, are those files gonna be added to the GitHub anyway because they are already in the local git repository ?
     
  8. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #8
    Yes.
     

Share This Page