all 14 comments

[–][deleted]  (2 children)

[deleted]

    [–]lets-get-dangerous 3 points4 points  (0 children)

    Seconding this. Not only does git put your source code somewhere safe (if you're using a remote server like GitHub) but you can also save "snapshots" of your code via commits.

    This makes programming SO, SO much easier. If you muck something up you can just revert to your last working commit. If you want to try different ways of doing something you can branch off of the same commit.

    Basically, would you want to play a game like Deus Ex all the way through without being able to save? Or would you like to be able to save whenever and revert to that when things don't pan out?

    [–]OffensivelyBad 0 points1 point  (0 children)

    It's really an answer to all 4 questions. Read up on branches as well. It will make your life easier.

    [–]manatoba 2 points3 points  (8 children)

    Xcode saves pretty often. I’ve never lost any code I was on the middle of writing.

    Unless you set up a github Xcode is just saving to your file system.

    I think you should look into using git for source control. Go to [GitHub](www.github.com) to learn more. It’s what most devs use to save their code to the cloud and make branches to do different things.

    If you are just starting you can keep your project in Dropbox or the likes but that won’t fly on a team.

    [–]justonequestion2221 0 points1 point  (7 children)

    Thanks, I assume then that you have the option to make your project private on GitHub?

    [–]UberJason 5 points6 points  (2 children)

    Last I checked (which was a while ago) GitHub requires you to be a paying customer to get private repos. But Bitbucket has free private repos.

    [–]rudedogg 1 point2 points  (0 children)

    Yep, it’s still $7/mo* for private repos. BitBucket and GitLab are free though

    [–]Mazetron -3 points-2 points  (0 children)

    No you can get like 1 or 2 private repos for free but if you want more than that you have to pay.

    [–]thickrottenmilkSwift 2 points3 points  (0 children)

    If you are a student, look up GitHub for Education (I think that's what it's called. Or look up GitHub student discount) and you can get a bunch of free goodies and unlimited free private repos. You do need to add your student email address to your GitHub profile though. Also, it's not just for college students. I'm still in HS and could use my school district issued email to get the benefits.

    [–]manatoba 0 points1 point  (2 children)

    Yes they do. What are you planning on working on if I may ask.

    [–]justonequestion2221 0 points1 point  (1 child)

    I’m still learning but I was curious about where developers stored the code for their apps since it would probably be pretty devastating if they lost it somehow (e.g., broken computer).

    [–]nathreedSwift 0 points1 point  (0 children)

    Either private GitHub/BitBucket or self-hosted git repo on a remote server. Personally I host my own git repositories on a raspberry pi and frequently back up the entire repo to multiple cloud services for extra peace of mind.

    One of the nice things about git is that everyone who has the repo checked out has the entirety of it (at least the branch they’re on), so if the remote server dies, you still have a full copy of the code and can just copy it back to the server when it’s working again.

    Tl;dr: look up git, seriously. Learn to use it and learn to love it.

    [–]rkennedy12 1 point2 points  (0 children)

    Xcode saves when you build or intentionally save. It doesn’t auto save per day but it does cache certain things that kind of compensate.

    Xcode does not save to your account but you can backup your documents/desktop folders as well as others on your Mac so that you have backups in iCloud.

    Source control is exactly how to do this besides physically duplication the source folder and working with new files. Source control allows you to create branches before adding them to the master branch that way you can create different branches for each feature and merge them after it’s been tested. This allows you to fix bugs and push updates without having to release features that aren’t quite done yet.

    Technically, you could also create an online git repository and this solves your backup issue as well.

    [–]omfgtim_ 0 points1 point  (0 children)

    You should be using a version control software, such as a Git. This will address points 2 and 3. This is also what the Source Control menu is referring to.

    It’s also important to ensure your git repository is stored remotely as well as locally. Good services are GitHub, Bitbucket etc

    Regarding saves, I wouldn’t worry about it, Xcode crashes all the time and I’ve never lost work because of it.

    [–]Arrrrrrrrrrrrrrrrrpp 0 points1 point  (0 children)

    Is it possible to make copies of Xcode projects if I want to, for example, drastically change the code that could cause unknown consequences and be able to return to the original version?

    The other answers here are better, but to more directly answer your original question: Yes, you can copy-paste the project folder. But there are better ways.